CakePHP : paginate not working on search results <p>I have a method, that performs a search and sends the results to its view. The search results are available only on the first page of the pagination results. The subsequent paginated pages do not have data and have warnings/errors about invalid index/variables:</p> <p><strong>Controller</strong></p> <pre><code>public function show_list () { $i_state_id = $this-&gt;data['Contact']['state_id']; $str_city = $this-&gt;data['Contact']['city']; $this-&gt;Contact-&gt;recursive = -1; $this-&gt;paginate = array ( 'conditions' =&gt; array ('Contact.state_id' =&gt; $i_state_id, 'Contact.city'=&gt; $str_city), 'fields' =&gt; array('Contact.id', 'Contact.name', 'Contact.mobile1', 'Contact.city'), 'order' =&gt; array ('Contact.id' =&gt; 'desc'), 'limit' =&gt; 2, 'recursive' =&gt; -1 ); $contacts = $this-&gt;paginate('Contact'); $this-&gt;set ('contacts', $contacts); $this-&gt;set('state_id', $i_state_id); $this-&gt;set('city', $str_city); } </code></pre> <p><strong>View (show_list.ctp)</strong></p> <pre><code>&lt;div class="contacts index"&gt; &lt;h2&gt;&lt;?php echo __('Select the list of contacts, that you wish to move.'); ?&gt;&lt;/h2&gt; &lt;?php echo $this-&gt;Form-&gt;create('Contact',array('action'=&gt;'add_contacts_to_user'));?&gt; &lt;table cellpadding="0" cellspacing="0"&gt; &lt;tr&gt; &lt;th&gt;&lt;?php echo $this-&gt;Paginator-&gt;sort('id'); ?&gt;&lt;/th&gt; &lt;th&gt;&lt;?php echo $this-&gt;Form-&gt;checkbox('all', array('label'=&gt;"Select All", "onclick" =&gt;"toggleChecked(this.checked)" )); ?&gt;&lt;/th&gt; &lt;th&gt;&lt;?php echo $this-&gt;Paginator-&gt;sort('name'); ?&gt;&lt;/th&gt; &lt;th&gt;&lt;?php echo $this-&gt;Paginator-&gt;sort('Contact Info'); ?&gt;&lt;/th&gt; &lt;th&gt;&lt;?php echo $this-&gt;Paginator-&gt;sort('city'); ?&gt;&lt;/th&gt; &lt;/tr&gt; &lt;?php foreach ($contacts as $contact): ?&gt; &lt;tr&gt; &lt;td&gt;&lt;?php echo h($contact['Contact']['id']); ?&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt;&lt;?php echo $this-&gt;Form-&gt;checkbox('Contact.id.'.$contact['Contact']['id'], array('class' =&gt; 'checkbox', 'value'=&gt; $contact['Contact']['id'],'hiddenField' =&gt; false)); ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo h($contact['Contact']['name']); ?&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt;&lt;?php echo h($contact['Contact']['mobile1']); ?&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt;&lt;?php echo h($contact['Contact']['city']); ?&gt;&amp;nbsp;&lt;/td&gt; &lt;/td&gt; &lt;/tr&gt; &lt;?php endforeach; ?&gt; &lt;/table&gt; &lt;?php echo $this-&gt;Form-&gt;end("Move to Address Book"); ?&gt; &lt;p&gt; &lt;?php echo $this-&gt;Paginator-&gt;counter(array( 'format' =&gt; __('Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}') )); ?&gt; &lt;/p&gt; &lt;div class="paging"&gt; &lt;?php echo $this-&gt;Paginator-&gt;prev('&lt; ' . __('previous'), array(), null, array('class' =&gt; 'prev disabled')); echo $this-&gt;Paginator-&gt;numbers(array('separator' =&gt; '')); echo $this-&gt;Paginator-&gt;next(__('next') . ' &gt;', array(), null, array('class' =&gt; 'next disabled')); ?&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>How do I get the second and subsequent pages to show the results of the search pages?</p>