<commit_before><?php

namespace Stfalcon\Bundle\BlogBundle\Controller;

use Application\Bundle\UserBundle\Entity\User;
use Knp\Bundle\PaginatorBundle\Pagination\SlidingPagination;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Stfalcon\Bundle\BlogBundle\Entity\Post;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Zend\Feed\Writer\Entry;
use Zend\Feed\Writer\Feed;

/**
 * PostController
 *
 * @author <NAME> <<EMAIL>>
 */
class PostController extends AbstractController
{
    /**
     * List of posts for admin
     *
     * @param Request $request Request
     * @param int     $page    Page number
     *
     * @return array
     *
     * @Route("/blog/{title}/{page}", name="blog",
     *      requirements={"page"="\d+", "title"="page"},
     *      defaults={"page"="1", "title"="page"})
     * @Template()
     */
    public function indexAction(Request $request, $page)
    {
        $postRepository = $this->getDoctrine()->getRepository('StfalconBlogBundle:Post');

        $postsQuery = $postRepository->getAllPublishedPostsAsQuery($request->getLocale());
        $posts      = $this->get('knp_paginator')->paginate($postsQuery, $page, 10);<commit_msg>Fix pagination problem<commit_after><?php

namespace Stfalcon\Bundle\BlogBundle\Controller;

use Application\Bundle\UserBundle\Entity\User;
use Knp\Bundle\PaginatorBundle\Pagination\SlidingPagination;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Stfalcon\Bundle\BlogBundle\Entity\Post;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Zend\Feed\Writer\Entry;
use Zend\Feed\Writer\Feed;

/**
 * PostController
 *
 * @author <NAME> <<EMAIL>>
 */
class PostController extends AbstractController
{
    /**
     * List of posts for admin
     *
     * @param Request $request Request
     * @param int     $page    Page number
     *
     * @return array
     *
     * @Route("/blog/{title}/{page}", name="blog",
     *      requirements={"page"="\d+", "title"="page"},
     *      defaults={"page"="1", "title"="page"})
     * @Template()
     */
    public function indexAction(Request $request, $page)
    {
        $postRepository = $this->getDoctrine()->getRepository('StfalconBlogBundle:Post');

        $postsQuery = $postRepository->getAllPublishedPostsAsQuery($request->getLocale());
        $posts      = $this->get('knp_paginator')->paginate($postsQuery->getResult(), $page, 10);
{'fraction_non_alphanumeric': 0.14037526059763725, 'fraction_numerical': 0.0020847810979847115, 'mean_word_length': 4.215579710144928, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 22, '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': '6027524', 'n_tokens_mistral': 861, 'n_tokens_neox': 840, 'n_words': 139}