title: What is cakephp's 'maximum depth reached', I got this error while patination with message 'address not found'
body: <p>I am new to cakephp and using 2.4 version with bootstrap css.
  I have almost finished my project but getting some errors while creating search with pagination.</p>
  
  <p>While pagination in Cakephp, first pages are working fine but last 2-3 pages shows error as the requested address was not found on this server. </p>
  
  <p>tables are below. 
  universities, courses, semesters, subjects, units, topics
  respectively these models having hasMany relationships from left to right.
  e.g. universities hasMany courses, courses hasMany semesters.....</p>
  
  <p>my search actions is as below. </p>
  
  <pre><code>public function searchresults() {
          if($this-&gt;request-&gt;is('post')) {
              $unid=$this-&gt;data['University']['universities'];
              $searched =  $this-&gt;data['University']['searchtxt'];
              $this-&gt;Session-&gt;write('Searched.stext',$searched);
              $this-&gt;Session-&gt;write('Searched.univ',$unid);
          }
  
              $unid=$this-&gt;Session-&gt;read('Searched.univ');
              $searched = $this-&gt;Session-&gt;read('Searched.stext');
  
              //Create Join to find total numbers of records after search
              $this-&gt;Topic-&gt;bindModel(array(
                  'belongsTo' =&gt; array(
                      'Unit' =&gt; array(
                                  'foreignKey' =&gt; false,
                                  'type' =&gt; 'RIGHT',
                                  'conditions' =&gt; array(
                                  'Topic.unit_id = Unit.id' ,
                                  )
                              ),
                      'Subject' =&gt; array(
                                  'foreignKey' =&gt; false,
                                  'type' =&gt; 'RIGHT',
                                  'conditions' =&gt; array(
                                      'Unit.subject_id = Subject.id',
                                  )
                              ),
                      'Semester' =&gt; array(
                                  'foreignKey'=&gt; false,
                                  'type'=&gt;'RIGHT',
                                  'conditions' =&gt; array (
                                      'Subject.semester_id = Semester.id'
                                  )
                              ),  
                      'Course' =&gt; array(
                                  'foreignKey'=&gt; false,
                                  'type'=&gt;'RIGHT',
                                  'conditions' =&gt; array (
                                      'Semester.course_id = Course.id'
                                  )
                              ),
                      'University' =&gt; array(
                                  'foreignKey'=&gt; false,
                                  'type'=&gt;'RIGHT',
                                  'conditions' =&gt; array (
                                      'Course.university_id = University.id'
                                  )
                              )
                  )
              ));
              $this-&gt;Paginator-&gt;settings=array(
                  'limit'=&gt;10,
                  'page'=&gt;1,
                  'conditions' =&gt; array('or'=&gt;array(
                      'Topic.name LIKE' =&gt; '%'.$searched.'%',
                      'Topic.description LIKE' =&gt; '%'.$searched.'%'
                  )),
              );
              $data=$this-&gt;paginate('Topic');
              //debug($data);
              $this-&gt;set('searched',$searched);
              $this-&gt;set('sresults',$data);
              $this-&gt;set('uni_id',$unid);
  
  
      }
  </code></pre>
  
  <p>my view's pagination part code is as below: </p>
  
  <pre><code>&lt;div class="row"&gt;&lt;!--Pagination links begins --&gt;
                                      &lt;div class="col-sm-8 col-sm-offset-3"&gt;
                                      &lt;!-- Shows the next and previous links --&gt;
                                      &lt;ul class="pagination largescreen"&gt;
                                      &lt;li class="disabled-page mobileview"&gt;
                                          Page &lt;?php echo $this-&gt;Paginator-&gt;counter(); ?&gt;
                                      &lt;/li&gt;   
                                      &lt;?php echo $this-&gt;Paginator-&gt;prev('«', array('tag'=&gt;'li'), null, array('class' =&gt; 'disabled-page','tag'=&gt;'li')); ?&gt;
                                      &lt;!-- Shows the page numbers --&gt;
                                      &lt;?php 
                                          echo $this-&gt;Paginator-&gt;numbers(array(
                                              'tag'=&gt;'li',
                                              'separator'=&gt;'',
                                              'currentClass'=&gt;'active',
                                              'currentTag'=&gt;'a',
                                              'modulus'=&gt;4
  
                                          )); 
                                      ?&gt;
  
                                      &lt;?php echo $this-&gt;Paginator-&gt;next('»', array('tag'=&gt;'li'), null, array('class' =&gt; 'disabled-page','tag'=&gt;'li')); ?&gt;
                                      &lt;/ul&gt;
                                      &lt;/div&gt;
                                      &lt;div&gt;
                                      &lt;ul class="pagination pagination-sm smallscreen" style="overflow:auto;"&gt;
                                      &lt;li class="disabled-page mobileview"&gt;
                                          Page &lt;?php echo $this-&gt;Paginator-&gt;counter(); ?&gt;
                                      &lt;/li&gt;   
                                      &lt;?php echo $this-&gt;Paginator-&gt;prev('«', array('tag'=&gt;'li'), null, array('class' =&gt; 'disabled-page','tag'=&gt;'li')); ?&gt;
                                      &lt;!-- Shows the page numbers --&gt;
                                      &lt;?php 
                                          echo $this-&gt;Paginator-&gt;numbers(array(
                                              'tag'=&gt;'li',
                                              'separator'=&gt;'',
                                              'currentClass'=&gt;'active',
                                              'currentTag'=&gt;'a',
                                              'modulus'=&gt;8
  
                                          )); 
                                      ?&gt;
  
                                      &lt;?php echo $this-&gt;Paginator-&gt;next('»', array('tag'=&gt;'li'), null, array('class' =&gt; 'disabled-page','tag'=&gt;'li')); ?&gt;
                                      &lt;/ul&gt;
                                      &lt;/div&gt;
                              &lt;/div&gt;&lt;!--Pagination links ends --&gt;
  </code></pre>
  
  <p>Please help as i am stuck after searching a lot about this...</p>