/**
  * @param Pagerfanta $pager
  *
  * @return array
  */
 protected function getPagerMeta(Pagerfanta $pager)
 {
     if ($pager instanceof OutOfRangePager) {
         return array('currentPage' => $pager->getOriginalPage(), 'maxPerPage' => $pager->getMaxPerPage(), 'hasNextPage' => false, 'outOfRange' => true);
     }
     $meta = array('currentPage' => $pager->getCurrentPage(), 'maxPerPage' => $pager->getMaxPerPage(), 'pagesCount' => $pager->getNbPages(), 'hasNextPage' => $pager->hasNextPage(), 'resultsCount' => $pager->getNbResults(), 'hasPreviousPage' => $pager->hasPreviousPage());
     if ($pager->hasNextPage()) {
         $meta['nextPage'] = $pager->getNextPage();
     }
     if ($pager->hasPreviousPage()) {
         $meta['previousPage'] = $pager->getPreviousPage();
     }
     return $meta;
 }