title: Zend_Paginator + Query Paramenter (ZF1)
body: <p>I am using the ZF1 with Zend_Paginator but if I have a search that brings all data without filter, works perfectly, but if I have a query filter paging works only on the first page.</p>
  
  <pre><code>   public function getConsultaTelefones($setor)
         {      
  
            if ($setor != "") {
  
             $select = $this-&gt;select()
                   -&gt;setIntegrityCheck ( false )
                   -&gt;from ( array('t' =&gt; 'sca_telefone'))      
                   -&gt;joinInner ( array ('p' =&gt; 'sca_posto'), 't.idPosto = p.idPosto')   
                   -&gt;joinInner ( array ('l' =&gt; 'sca_lotacao'), 't.idLotacao = l.idLotacao')   
                   -&gt;where("l.idLotacao = ?", $setor) ;   
  
            $resultado = $this-&gt;fetchAll($select);
  
            } else {
  
               $select = $this-&gt;select()
                   -&gt;setIntegrityCheck ( false )
                   -&gt;from ( array('t' =&gt; 'sca_telefone'))      
                   -&gt;joinInner ( array ('p' =&gt; 'sca_posto'), 't.idPosto = p.idPosto')   
                   -&gt;joinInner ( array ('l' =&gt; 'sca_lotacao'), 't.idLotacao = l.idLotacao');
  
            $resultado = $this-&gt;fetchAll($select);
  
            }
  
         return $resultado;
  
         }   
  </code></pre>
  
  <p>In the parameter $ sector it brings all the data as the filter and creates the correct pagination, but only the first page because if I click the next or last page he "recreates" the paging all table data.</p>
  
  <pre><code>public function paginacaoConsulta($dados)
     {
        $pagina = intval($this-&gt;_getParam('pagina', 1));
  
        $paginator = Zend_Paginator::factory($dados);
          $paginator-&gt;setItemCountPerPage(5);
          $paginator-&gt;setPageRange(7);
          $paginator-&gt;setCurrentPageNumber($pagina);
  
          $this-&gt;view-&gt;paginator = $paginator;   
  
      }
  
     public function consultarAction()
     {
        $setor = $this-&gt;_getParam('setor');
  
        $modLotacao = new Sca_Model_Lotacao('sca');
  
        $resultado = $modLotacao-&gt;getConsultaTelefones($setor);
  
        $this-&gt;paginacaoConsulta($resultado);
          }
  </code></pre>
  
  <p>Already researched several things but nothing has met me. Please I need help.</p>
  
  <p>Follow the rest of the codes:</p>
  
  <pre><code>&lt;?php echo $this-&gt;paginationControl($this-&gt;paginator, 'Sliding', 'paginacao.phtml'); ?&gt;
  
  
  
  &lt;nav&gt;
    &lt;ul class="pagination"&gt;
  
      &lt;li&gt;
  
      &lt;!-- Link para a primeira página --&gt;
      &lt;?php if (isset($this-&gt;previous)): ?&gt;
          &lt;a title="Primeira Página" href="&lt;?php echo $this-&gt;url(array('pagina' =&gt; $this-&gt;first)); ?&gt;" aria-label="Previous"&gt;&amp;laquo; Primeira&lt;/a&gt;
      &lt;?php else: ?&gt;
          &lt;a class="current" title="Primeira Página" href="&lt;?php echo $this-&gt;url(array('pagina' =&gt; $this-&gt;first)); ?&gt;" aria-label="Previous"&gt;&amp;laquo; Primeira&lt;/a&gt;
      &lt;?php endif; ?&gt;
  
      &lt;/li&gt;
  
      &lt;li&gt;
  
          &lt;?php if ($this-&gt;pageCount): ?&gt;
  
          &lt;?php if (isset($this-&gt;previous)): ?&gt;
  
            &lt;a href="&lt;?php echo $this-&gt;url(array('pagina' =&gt; $this-&gt;previous)); ?&gt;" aria-label="Previous"&gt;
               &lt;span aria-hidden="true"&gt;&amp;laquo;&lt;/span&gt;
            &lt;/a&gt;
  
          &lt;?php else: ?&gt;
  
            &lt;span aria-hidden="true"&gt;&amp;laquo;&lt;/span&gt;
  
          &lt;?php endif; ?&gt;
  
      &lt;/li&gt; 
  
      &lt;li&gt;
  
          &lt;?php foreach ($this-&gt;pagesInRange as $pagina): ?&gt;
  
            &lt;?php if ($pagina != $this-&gt;current): ?&gt;
  
              &lt;a href="&lt;?php echo $this-&gt;url(array('pagina' =&gt; $pagina)); ?&gt;"&gt;
                  &lt;?php echo $pagina; ?&gt;
              &lt;/a&gt;
  
            &lt;?php else: ?&gt;
  
              &lt;a href="#"&gt;&lt;?php echo $pagina; ?&gt;&lt;/a&gt;
  
            &lt;?php endif; ?&gt;
  
          &lt;?php endforeach; ?&gt;
  
      &lt;/li&gt;
  
      &lt;li&gt;
  
          &lt;?php if (isset($this-&gt;next)): ?&gt;
  
            &lt;a href="&lt;?php echo $this-&gt;url(array('pagina' =&gt; $this-&gt;next)); ?&gt;" aria-label="Next" &gt;
              &lt;span aria-hidden="true"&gt;&amp;raquo;&lt;/span&gt;
            &lt;/a&gt;
  
          &lt;?php else: ?&gt;
            &lt;span aria-hidden="true"&gt;&amp;raquo;&lt;/span&gt;
          &lt;?php endif; ?&gt;
  
          &lt;?php endif; ?&gt;
  
      &lt;/li&gt;
  
      &lt;li&gt;
  
      &lt;!-- Última página --&gt;
      &lt;?php if (isset($this-&gt;next)): ?&gt;
          &lt;a title="Última Página" href="&lt;?php echo $this-&gt;url(array('pagina' =&gt; $this-&gt;last)); ?&gt;" aria-label="Next"&gt;Última &amp;raquo;&lt;/a&gt;
      &lt;?php else: ?&gt;
          &lt;a class="current" title="Última Página" href="&lt;?php echo $this-&gt;url(array('pagina' =&gt; $this-&gt;last)); ?&gt;" aria-label="Next"&gt;Última &amp;raquo;&lt;/a&gt;
      &lt;?php endif; ?&gt;
  
      &lt;/li&gt;
  
    &lt;/ul&gt;
  &lt;/nav&gt;
  </code></pre>