private function addPagination(&$oQuery, $oTemplate)
 {
     $iPage = (int) (isset($_REQUEST[self::PAGINATION_PARAM]) ? $_REQUEST[self::PAGINATION_PARAM] : 1);
     $oPager = new SimplePager($oQuery, $iPage, $this->iEntriesPerPage);
     if (!$oPager->requiresPagination() || !$oTemplate->hasIdentifier('pagination')) {
         return;
     }
     // Basic page link without page number
     $sBasePageLink = LinkUtil::link(array_merge(FrontendManager::$CURRENT_NAVIGATION_ITEM->getLink(), array(self::PAGINATION_PARAM)));
     $oPager->setPageLinkBase($sBasePageLink);
     $oQuery = $oPager->getQuery();
     $oPagerTemplate = $this->constructTemplate('pagination');
     // All page links including current one
     $iTotalPages = $oPager->getTotalPageCount();
     foreach ($oPager as $oPage) {
         if ($oPage->page === $iPage) {
             $oPageLink = TagWriter::quickTag('span', array(), $oPage->page);
         } else {
             $oPageLink = TagWriter::quickTag('a', array('title' => TranslationPeer::getString('pager.go_to_page', null, null, array('page_number' => $i)), 'href' => $oPage->link), $oPage->page);
         }
         $oPagerTemplate->replaceIdentifierMultiple('page_links', $oPageLink);
     }
     $oPagerTemplate->replaceIdentifier('previous_link', $oPager->getPreviousLink());
     $oPagerTemplate->replaceIdentifier('next_link', $oPager->getNextLink());
     $oTemplate->replaceIdentifier('pagination', $oPagerTemplate);
     return $oPager;
 }