title: Zend Pagination - Seems Not to be limiting number of results on each page
body: <p>I am relatively new to The Zend framework having only been working with it probably two months at the most. I am now trying to get a list of results from a query I run, send it through the zend paginator class and display 4 results per page, however it does not seem to be recognising when it has got 4 results, I believe there is an error in my code but I can not for the life of me see it, I was hoping someone here will be able to pick up on it  and help me and out and probably tell me it is something stupid that I have missed. Thanks here is the code I have written.</p>
  
  <p>This the query in my model</p>
  
  <pre><code>public function getAllNews()
  {
      $db = Zend_Registry::get('db');
  
      $sql = "SELECT * FROM $this-&gt;_name WHERE flag = 1 ORDER BY created_at";
  
      $query = $db-&gt;query($sql);
      while ($row = $query-&gt;fetchAll()) {
          $result[] = $row;
      }
  
      return $result;
  }
  </code></pre>
  
  <p>This is code in my controller</p>
  
  <pre><code>function preDispatch()
  {
  $this-&gt;_helper-&gt;layout-&gt;setLayout('latestnews');
      Zend_Loader::loadClass('newsArticles');
      $allNews = new newsArticles();
      $this-&gt;view-&gt;allNews = $allNews-&gt;getAllnews();
      //die (var_dump($this-&gt;view-&gt;allNews));
      $data = $this-&gt;view-&gt;allNews;
      // Instantiate the Zend Paginator and give it the Zend_Db_Select instance  Argument ($selection)
      $paginator = Zend_Paginator::factory($data);
      // Set parameters for paginator
      $paginator-&gt;setCurrentPageNumber($this-&gt;_getParam("page")); // Note: For this to work of course, your URL must be something like this: http://localhost:8888/index/index/page/1  &lt;- meaning we are currently on page one, and pass that value into the "setCurrentPageNumber"
      $paginator-&gt;setItemCountPerPage(1);
      $paginator-&gt;setPageRange(4);
      // Make paginator available in your views
      $this-&gt;view-&gt;paginator = $paginator;
      //die(var_dump($data));
  }
  </code></pre>
  
  <p>Below is the view that builds the paginator,</p>
  
  <pre><code>    &lt;?php if ($this-&gt;pageCount): ?&gt; 
  &lt;div class="paginationControl"&gt;
  &lt;!-- Previous page link --&gt; 
  &lt;?php if (isset($this-&gt;previous)): ?&gt; 
    &lt;a href="&lt;?= $this-&gt;url(array('page' =&gt; $this-&gt;previous)); ?&gt;"&gt;&amp;lt; Previous&lt;/a&gt; | 
  &lt;?php else: ?&gt; 
    &lt;span class="disabled"&gt;&amp;lt; Previous&lt;/span&gt; | 
  &lt;?php endif; ?&gt; 
  
  &lt;!-- Numbered page links --&gt;
  &lt;?php foreach ($this-&gt;pagesInRange as $page): ?&gt; 
    &lt;?php if ($page != $this-&gt;current): ?&gt;
      &lt;a href="&lt;?= $this-&gt;url(array('page' =&gt; $page)); ?&gt;"&gt;&lt;?= $page; ?&gt;&lt;/a&gt; | 
    &lt;?php else: ?&gt;
      &lt;?= $page; ?&gt; | 
    &lt;?php endif; ?&gt;
  &lt;?php endforeach; ?&gt;
  
  &lt;!-- Next page link --&gt; 
  &lt;?php if (isset($this-&gt;next)): ?&gt; 
    &lt;a href="&lt;?= $this-&gt;url(array('page' =&gt; $this-&gt;next)); ?&gt;"&gt;Next &amp;gt;&lt;/a&gt;
  &lt;?php else: ?&gt; 
    &lt;span class="disabled"&gt;Next &amp;gt;&lt;/span&gt;
  &lt;?php endif; ?&gt; 
  &lt;/div&gt; 
  &lt;?php endif; ?&gt; 
  </code></pre>
  
  <p>And finally the code the makes up my view</p>
  
  <pre><code>&lt;div id="rightColumn"&gt;
                  &lt;h3&gt;Latest News&lt;/h3&gt;
                  &lt;?php if (count($this-&gt;paginator)): ?&gt;
                      &lt;ul&gt;
                          &lt;?php foreach ($this-&gt;paginator as $item): ?&gt;
                              &lt;?php
                              foreach ($item as $k =&gt; $v)
                              {
                                  echo "&lt;li&gt;" . $v['title'] . "&lt;/li&gt;";
                              }
                              ?&gt;
  
                          &lt;?php endforeach; ?&gt;
                      &lt;/ul&gt;
                  &lt;?php endif; ?&gt;
  
  &lt;?= $this-&gt;paginationControl($this-&gt;paginator, 'Sliding', '/latestnews/partial_pagination_control.phtml'); ?&gt; 
                  &lt;/div&gt;
  </code></pre>
  
  <p>I will be greatful for any help you can give me.</p>
  
  <p>Thanks</p>
  
  <p>Sico</p>