<commit_before><?php

namespace Demofony2\AppBundle\Controller\Front\Participation;

use Demofony2\AppBundle\Entity\CitizenInitiative;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;

/**
 * CitizenInitiativeController.
 */
class CitizenInitiativeController extends Controller
{
    const ITEMS_BY_PAGE = 10;

    /**
     * @param int $open
     * @param int $closed
     * @Route("/participation/citizen-initiative/open{open}/", name="demofony2_front_participation_citizen_initiative_list_open")
     * @Route("/participation/citizen-initiative/closed{closed}/", name="demofony2_front_participation_citizen_initiative_list_closed")
     *
     * @return Response
     */
    public function listAction($open = 1, $closed = 1)
    {
        $openQueryBuilder = $this->getDoctrine()->getManager()->getRepository(
            'Demofony2AppBundle:CitizenInitiative'
        )->getOpenQueryBuilder();
        $closedQueryBuilder = $this->getDoctrine()->getManager()->getRepository(
            'Demofony2AppBundle:CitizenInitiative'
        )->getOpenQueryBuilder();

        $pagination = $this->get('app.pagination');
        $pagination->setItemsByPage(self::ITEMS_BY_PAGE)
            ->setFirstPaginationPage($open)
            ->setSecondPaginationPage($closed)
            ->setSecondPaginationQueryBuilder($closedQueryBuilder)
            ->setFirstPaginationQueryBuilder($openQueryBuilder)
            ->setFirstPaginationRoute('demofony2_front_participation_citizen_initiative_list_open')
            ->setSecondPaginationRoute('demofony2_front_participation_citizen_initiative_list_closed');
        list($open, $closed, $isOpenTab) = $pagination->getDoublePagination();

        return $this->render(
            ':Front/participation:citizen-initiatives.html.twig',
            array(
                'openInitiatives'   => $open,
                'closedInitiatives' => $closed,
                'open'              => $isOpenTab,
            )
        );
    }

    /**
     * @param Request           $request
     * @param CitizenInitiative $initiative
     * @Route("/participation/citizen-initiative/{id}/", name="demofony2_front_participation_citizen_initiative_detail")
     * @ParamConverter("initiative", class="Demofony2AppBundle:CitizenInitiative")
     *
     * @return Response
     */
    public function detailAction(Request $request, CitizenInitiative $initiative)
    {<commit_msg>fix citizen initiatives controller closed items load<commit_after><?php

namespace Demofony2\AppBundle\Controller\Front\Participation;

use Demofony2\AppBundle\Entity\CitizenInitiative;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;

/**
 * CitizenInitiativeController.
 */
class CitizenInitiativeController extends Controller
{
    const ITEMS_BY_PAGE = 10;

    /**
     * @param int $open
     * @param int $closed
     * @Route("/participation/citizen-initiative/open{open}/", name="demofony2_front_participation_citizen_initiative_list_open")
     * @Route("/participation/citizen-initiative/closed{closed}/", name="demofony2_front_participation_citizen_initiative_list_closed")
     *
     * @return Response
     */
    public function listAction($open = 1, $closed = 1)
    {
        $openQueryBuilder = $this->getDoctrine()->getManager()->getRepository('Demofony2AppBundle:CitizenInitiative')->getOpenQueryBuilder();
        $closedQueryBuilder = $this->getDoctrine()->getManager()->getRepository('Demofony2AppBundle:CitizenInitiative')->getClosedQueryBuilder();

        $pagination = $this->get('app.pagination');
        $pagination->setItemsByPage(self::ITEMS_BY_PAGE)
            ->setFirstPaginationPage($open)
            ->setFirstPaginationQueryBuilder($openQueryBuilder)
            ->setFirstPaginationRoute('demofony2_front_participation_citizen_initiative_list_open')
            ->setSecondPaginationPage($closed)
            ->setSecondPaginationQueryBuilder($closedQueryBuilder)
            ->setSecondPaginationRoute('demofony2_front_participation_citizen_initiative_list_closed');
        list($open, $closed, $isOpenTab) = $pagination->getDoublePagination();

        return $this->render(
            ':Front/participation:citizen-initiatives.html.twig',
            array(
                'openInitiatives'   => $open,
                'closedInitiatives' => $closed,
                'open'              => $isOpenTab,
            )
        );
    }

    /**
     * @param Request           $request
     * @param CitizenInitiative $initiative
     * @Route("/participation/citizen-initiative/{id}/", name="demofony2_front_participation_citizen_initiative_detail")
     * @ParamConverter("initiative", class="Demofony2AppBundle:CitizenInitiative")
     *
     * @return Response
     */
    public function detailAction(Request $request, CitizenInitiative $initiative)
    {
{'fraction_non_alphanumeric': 0.11298578199052133, 'fraction_numerical': 0.005308056872037914, 'mean_word_length': 3.681455190771961, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 45, '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': '4631509', 'n_tokens_mistral': 1528, 'n_tokens_neox': 1480, 'n_words': 182}