3 namespace Wallabag\CoreBundle\Helper
;
5 use Pagerfanta\Adapter\AdapterInterface
;
6 use Pagerfanta\Pagerfanta
;
7 use Symfony\Component\Routing\Router
;
8 use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage
;
10 class PreparePagerForEntries
15 public function __construct(TokenStorage
$token, Router
$router)
17 $this->user
= $token->getToken()->getUser();
18 $this->router
= $router;
22 * @param AdapterInterface $adapter
25 * @return null|Pagerfanta
27 public function prepare(AdapterInterface
$adapter, $page = 1)
29 $entries = new Pagerfanta($adapter);
30 $entries->setMaxPerPage($this->user
->getConfig()->getItemsPerPage());