<commit_before><?php
/**
 * Litus is a project by a group of students from the K.U.Leuven. The goal is to create
 * various applications to support the IT needs of student unions.
 *
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 *
 * @license http://litus.cc/LICENSE
 */

namespace MailBundle\Controller\Admin;

use CommonBundle\Component\FlashMessenger\FlashMessage,
    MailBundle\Entity\Entries\Academic as AcademicEntry,
    MailBundle\Entity\Entries\External as ExternalEntry,
    MailBundle\Entity\MailingList\Named as NamedList,
    MailBundle\Entity\MailingList\AdminMap as ListAdmin,
    MailBundle\Form\Admin\MailingList\Add as AddForm,
    MailBundle\Form\Admin\MailingList\Admin as AdminForm,
    MailBundle\Form\Admin\MailingList\Entry\Academic as AcademicForm,
    MailBundle\Form\Admin\MailingList\Entry\External as ExternalForm,
    Zend\View\Model\ViewModel;

class MailingListController extends \CommonBundle\Component\Controller\ActionController\AdminController
{
    public function manageAction()
    {
        $person = $this->getAuthentication()->getPersonObject();
        $editor = false;
        foreach ($person->getFlattenedRoles() as $role) {
            if ($role->getName() == 'editor') {
                $editor = true;
                break;
            }
        }

        if (!$editor) {
            $paginator = $this->paginator()->createFromArray(
                $this->getEntityManager()
                    ->getRepository('MailBundle\Entity\MailingList\Named')
                    ->findAllByAdmin($person),
                $this->getParam('page')
            );
        } else {
            $paginator = $this->paginator()->createFromEntity(
                'MailBundle\Entity\MailingList\Named',
                $this->getParam('page'),
                array(),
                array(
                    'name' => 'ASC'
                )
            );
        }

        return new ViewModel(
            array(
                'person' => $person,
                'entityManager' => $this->getEntityManager(),<commit_msg>Fixed a bug for @pmaene<commit_after><?php
/**
 * Litus is a project by a group of students from the K.U.Leuven. The goal is to create
 * various applications to support the IT needs of student unions.
 *
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 *
 * @license http://litus.cc/LICENSE
 */

namespace MailBundle\Controller\Admin;

use CommonBundle\Component\FlashMessenger\FlashMessage,
    MailBundle\Entity\Entries\Academic as AcademicEntry,
    MailBundle\Entity\Entries\External as ExternalEntry,
    MailBundle\Entity\MailingList\Named as NamedList,
    MailBundle\Entity\MailingList\AdminMap as ListAdmin,
    MailBundle\Form\Admin\MailingList\Add as AddForm,
    MailBundle\Form\Admin\MailingList\Admin as AdminForm,
    MailBundle\Form\Admin\MailingList\Entry\Academic as AcademicForm,
    MailBundle\Form\Admin\MailingList\Entry\External as ExternalForm,
    Zend\View\Model\ViewModel;

class MailingListController extends \CommonBundle\Component\Controller\ActionController\AdminController
{
    public function manageAction()
    {
        if (!$this->getAuthentication()->isAuthenticated())
            return new ViewModel();

        $editor = false;
        $person = $this->getAuthentication()->getPersonObject();
        foreach ($person->getFlattenedRoles() as $role) {
            if ($role->getName() == 'editor') {
                $editor = true;
                break;
            }
        }

        if (!$editor) {
            $paginator = $this->paginator()->createFromArray(
                $this->getEntityManager()
                    ->getRepository('MailBundle\Entity\MailingList\Named')
                    ->findAllByAdmin($person),
                $this->getParam('page')
            );
        } else {
            $paginator = $this->paginator()->createFromEntity(
                'MailBundle\Entity\MailingList\Named',
                $this->getParam('page'),
                array(),
                array(
                    'name' => 'ASC'
                )
            );
        }

        return new ViewModel(
            array(
                'person' => $person,
                'entityManager' => $this->getEntityManager(),
{'fraction_non_alphanumeric': 0.12406947890818859, 'fraction_numerical': 0.0, 'mean_word_length': 2.229424617625637, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 69, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5710724', 'n_tokens_mistral': 1244, 'n_tokens_neox': 1193, 'n_words': 248}