title: CakePHP 2.x Custom Route Pagination
body: <p>I have a the following custom route (which works fine):</p>
  
  <pre><code>Router::connect('/:city', array('controller' =&gt; 'dealers', 'action' =&gt; 'index'), array('city' =&gt; '[a-z]+'));
  </code></pre>
  
  <p>With this route, I am trying to get paginated pages 2, 3, …:</p>
  
  <pre><code>Router::connect('/:city/:id', array('controller' =&gt; 'dealers', 'action' =&gt; 'index'),
      array(
          'pass' =&gt; array('city', 'id'),
          'city' =&gt; '[a-z]+',
          'id' =&gt; '[0-9]+'
          )
  );
  </code></pre>
  
  <p>The <strong>first problem</strong> now is, that if I enter <em>domain.com/washington/2</em> it doesn't pass the id to Pagination and I still get page 1.</p>
  
  <p>The <strong>second problem</strong> is that I do not get the Pagination Helper to write the above link. If I try this in my view:</p>
  
  <pre><code>$this-&gt;Paginator-&gt;options(array
      ('url'=&gt; array(
          $city[0]['City']['url'],
          $this-&gt;params['id']
          )
      )
  );
  </code></pre>
  
  <p>It still gives me:</p>
  
  <p><em>http://domain.com/dealers/index/washington/page:2</em></p>
  
  <p>I apologize in advance if this is a no brainer, but I am new to this and couldn't figure it out with the available questions/answers here, or the docs.</p>
  
  <p><strong>UPDATE 1:</strong></p>
  
  <p>I now tried the following for <em>domain.com/washington/page/2</em> , but it just routes to pagination page 1:</p>
  
  <pre><code>Router::connect('/:city/:slug/:id', 
      array('controller' =&gt; 'dealers', 'action' =&gt; 'index'),
      array(
          'pass' =&gt; array('city', 'slug', 'id'),
          'city' =&gt; '[a-z]+',
          'slug' =&gt; '[a-z]+',
          'id' =&gt; '[0-9]+'
          )
  );
  </code></pre>
  
  <p>In the action I am doing this:</p>
  
  <pre><code>public function index($slug = null, $id = null) {some code}
  </code></pre>
  
  <p>In the view I added:</p>
  
  <pre><code>$this-&gt;Paginator-&gt;options(array('url' =&gt; $this-&gt;passedArgs));
  </code></pre>
  
  <p>Still no luck, I'd be very very glad if someone could help out!</p>