title: cakephp pagination says Error: An Internal Error Has Occurred
body: <p>I am fetching all my users and show them in list and pagination in CakePhp.
  But why it is giving me<br>
  <strong>Error: An Internal Error Has Occurred.</strong>
  and under the Stack Trace  the line </p>
  
  <p><strong><code>$data = $this-&gt;Paginator-&gt;paginate('User');</code></strong>  is highlighted.</p>
  
  <p><strong>UserhomeController.php</strong>   </p>
  
  <pre><code>&lt;?php
  
  App::uses('AppController', 'Controller');
  
  class UserhomeController extends AppController {
  
      public $components = array('Paginator', 'RequestHandler');
      public $helpers = array('Js', 'Paginator');
      public $paginate = array(
          'fields' =&gt; array('User.id', 'User.email'),
          'limit' =&gt; 25,
          'order' =&gt; array(
              'User.email' =&gt; 'asc'
          )
      );
  
      public function index() {
          $this-&gt;Paginator-&gt;settings = $this-&gt;paginate;
  
          // similar to findAll(), but fetches paged results
          $data = $this-&gt;Paginator-&gt;paginate('User');
          $this-&gt;set('user', $data);
      }
  
  }
  </code></pre>
  
  <p><strong>Userhome/index.ctp</strong></p>
  
  <pre><code> &lt;?php
      $this-&gt;Paginator-&gt;options(array(
          'update' =&gt; '#content',
          'evalScripts' =&gt; true
      ));
      ?&gt;
      &lt;div class="container bottom_padding background_color_E8E3D7 height_full padding_top box_shadow"&gt;
          &lt;table class="table table-striped background_color_eee"&gt;
              &lt;!-- Here is where we loop through our $users array, printing out post info --&gt;
  
              &lt;?php foreach ($data as $user): ?&gt;
                  &lt;tr&gt;
                      &lt;td&gt;&lt;?php echo $user['User']['id']; ?&gt;&lt;/td&gt;
                      &lt;td&gt;
                          &lt;?php echo $this-&gt;Html-&gt;link($user['User']['title'], array('controller' =&gt; 'users', 'action' =&gt; 'view', $user['User']['id']));
                          ?&gt;
                      &lt;/td&gt;
                      &lt;td&gt;&lt;?php echo $user['User']['email']; ?&gt;&lt;/td&gt;
                  &lt;/tr&gt;
              &lt;?php endforeach; ?&gt;
              &lt;?php unset($user); ?&gt;
          &lt;/table&gt;
          &lt;ul class="pagination"&gt;
              &lt;?php
              echo $this-&gt;Paginator-&gt;prev(__('&lt;&lt;'), array('tag' =&gt; 'li'), null, array('tag' =&gt; 'li', 'class' =&gt; 'disabled', 'disabledTag' =&gt; 'a'));
              echo $this-&gt;Paginator-&gt;numbers(array('separator' =&gt; '', 'currentTag' =&gt; 'a', 'currentClass' =&gt; 'active', 'tag' =&gt; 'li', 'first' =&gt; 1));
              echo $this-&gt;Paginator-&gt;next(__('&gt;&gt;'), array('tag' =&gt; 'li', 'currentClass' =&gt; 'disabled'), null, array('tag' =&gt; 'li', 'class' =&gt; 'disabled', 'disabledTag' =&gt; 'a'));
              ?&gt;
          &lt;/ul&gt;
          &lt;br/&gt; 
          &lt;?php
          echo $this-&gt;Paginator-&gt;counter(
                  'Page {:page} of {:pages}, showing {:current} records out of
           {:count} total, starting on record {:start}, ending on {:end}'
          );
          ?&gt;
  
      &lt;/div&gt;
      &lt;?php echo $this-&gt;Js-&gt;writeBuffer(); ?&gt;
  </code></pre>