- $entries->setCurrentPage($page);
-
- return $this->render(
- 'WallabagCoreBundle:Entry:entries.html.twig',
- array(
- 'form' => $form->createView(),
- 'entries' => $entries,
- 'currentPage' => $page,
- )
- );
-
- if ($request->query->has($form->getName())) {
- // manually bind values from the request
- $form->submit($request->query->get($form->getName()));
-
- // build the query from the given form object
- $this->get('lexik_form_filter.query_builder_updater')->addFilterConditions($form, $filterBuilder);
+ try {
+ $entries->setCurrentPage($page);
+ } catch (OutOfRangeCurrentPageException $e) {
+ if ($page > 1) {
+ return $this->redirect($this->generateUrl($type, ['page' => $entries->getNbPages()]), 302);
+ }