whiteoctober/Pagerfanta — pull request #135 by stloyd (2014-05-12 08:30:32+00:00)
Title: Added helper methods to OutOfRangeCurrentPageException

Use case for Symfony2:
```php
try {
$results = new Pagerfanta(new DoctrineORMAdapter($repository->findAll()));
$results->setMaxPerPage($request->get('per_page', 24));
$results->setCurrentPage($request->get('page', 1));
} catch (OutOfRangeCurrentPageException $e) {
$query = $request->query->all();
$query['page'] = $e->getMaxAllowedPage();

return $this->redirect($this->generateUrl('list', $query));
}
```
This helps i.e. when Google Bot indexed bigger max page than it's allowed now, and we __don't__ want to allow those old pages to exist in index (current approach with hidding and replacing, still holds old "broken" data in URL: `Pagerfanta::setNormalizeOutOfRangePages()` & `Pagerfanta::setAllowOutOfRangePages()`).