ezsystems/ezpublish-kernel — pull request #558 by lolautruche (2013-10-10 13:52:07+00:00)
Title: Fix EZP-21723: As a developer, I want to use PagerFanta to do my pagination

https://jira.ez.no/browse/EZP-21723

[Example of use](https://gist.github.com/lolautruche/6918631):

```php
criterion = new ContentTypeIdentifier( 'folder' );
$pager = new Pagerfanta(
new ContentSearchAdapter( $query, $this->getRepository()->getSearchService() )
);
// Let's list 2 folders per page, even if it doesn't make sense :)
$pager->setMaxPerPage( 2 );
// Defaults to page 1 or get "page" query parameter
$pager->setCurrentPage( $this->getRequest()->get( 'page', 1 ) );

return $this->render(
'AcmeTestBundle::my_template.html.twig',
array(
'totalFolderCount' => $pager->getNbResults(),
'pagerFolder' => $pager
)
);
}
}
```

```jinja
{% extends noLayout ? viewbaseLayout : "eZDemoBundle::pagelayout.html.twig" %}

{% block content %}

Listing folder content objects: {{ totalFolderCount }} objects found.

{% for folder in pagerFolder %}

{{ ez_content_name( folder ) }}

{% endfor %}

{% if pagerFolder.haveToPaginate() %}{{ pagerfanta( pagerFolder, 'twitter_bootstrap_translated') }}{% endif %}

{% endblock %}
```