<commit_before><?php

namespace Neikeq\ClubsBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class ClubsController extends Controller
{
    const clubsPerPage = 5;

    public function clubsAction()
    {
        return $this->clubsPageAction(1);
    }

    public function clubsPageAction($page)
    {
        $em = $this->get('doctrine.orm.entity_manager');

        $clubsCountQB = $em->createQueryBuilder();
        $clubsCountQB->select('count(c.id)')
            ->from('NeikeqClubsBundle:Clubs','c');
        $resultAllClubs = $clubsCountQB->getQuery()->getSingleScalarResult();

        $pageClubsQB = $em->createQueryBuilder();
        $pageClubsQB->select('c.id, c.name, c.creation')
           ->from('NeikeqClubsBundle:Clubs','c')
           ->setFirstResult(($page - 1) * self::clubsPerPage)
           ->setMaxResults(self::clubsPerPage);

        $results = $pageClubsQB->getQuery()->getResult();

        $clubs = array();

        foreach ($results as $club) {
            array_push($clubs, array("id" => $club['id'], "name" => $club['name'],
                "creation" => $club['creation'], "manager" => "", "members" => ""));
        }

        $user = $this->getUser();
        $username = $user == null ? '' : $user->getUsername();

        $twigParams = array('username' => $username, 'clubs' => $clubs,
            'pages' => ceil($resultAllClubs / self::clubsPerPage));

        return $this->render('NeikeqClubsBundle:Default:clubs.html.twig', $twigParams);
    }

    public function createAction()
    {
        $this->denyAccessUnlessGranted('ROLE_USER', null, 'You are not allowed to access this page!');

        return $this->render('NeikeqClubsBundle:Default:create.html.twig');
    }
}<commit_msg>Added some comments in ClubsController<commit_after><?php

namespace Neikeq\ClubsBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class ClubsController extends Controller
{
    const clubsPerPage = 5;

    public function clubsAction()
    {
        return $this->clubsPageAction(1);
    }

    public function clubsPageAction($page)
    {
        $em = $this->get('doctrine.orm.entity_manager');

        // get the number of clubs registered
        $clubsCountQB = $em->createQueryBuilder();
        $clubsCountQB->select('count(c.id)')
            ->from('NeikeqClubsBundle:Clubs','c');
        $resultAllClubs = $clubsCountQB->getQuery()->getSingleScalarResult();

        // get a result of clubs for the current page
        $pageClubsQB = $em->createQueryBuilder();
        $pageClubsQB->select('c.id, c.name, c.creation')
           ->from('NeikeqClubsBundle:Clubs','c')
           ->setFirstResult(($page - 1) * self::clubsPerPage)
           ->setMaxResults(self::clubsPerPage);
        $results = $pageClubsQB->getQuery()->getResult();

        // retrieve the clubs information from the result
        $clubs = array();
        foreach ($results as $club) {
            array_push($clubs, array("id" => $club['id'], "name" => $club['name'],
                "creation" => $club['creation'], "manager" => "", "members" => ""));
        }

        // if user is not authenticated, set username to empty
        $user = $this->getUser();
        $username = $user == null ? '' : $user->getUsername();

        // params for the twig template
        $twigParams = array('username' => $username, 'clubs' => $clubs,
            'pages' => ceil($resultAllClubs / self::clubsPerPage));

        return $this->render('NeikeqClubsBundle:Default:clubs.html.twig', $twigParams);
    }

    public function createAction()
    {
        $this->denyAccessUnlessGranted('ROLE_USER', null, 'You are not allowed to access this page!');

        return $this->render('NeikeqClubsBundle:Default:create.html.twig');
    }
}
{'fraction_non_alphanumeric': 0.1600105097214924, 'fraction_numerical': 0.0015764582238570678, 'mean_word_length': 2.940993788819876, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 57, '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': '5522379', 'n_tokens_mistral': 1210, 'n_tokens_neox': 1145, 'n_words': 214}