<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -297,7 +297,8 @@ module WillPaginate
     # Returns URL params for +page_link_or_span+, taking the current GET params
     # and &lt;tt&gt;:params&lt;/tt&gt; option into account.
     def url_for(page)
-      unless @url_string
+      page_one = page == 1
+      unless @url_string and !page_one
         @url_params = { :escape =&gt; false }
         # page links should preserve GET parameters
         stringified_merge @url_params, @template.params if @template.request.get?
@@ -309,19 +310,20 @@ module WillPaginate
           
           stringified_merge @url_params, page_param
         else
-          @url_params[param_name] = 1
+          @url_params[param_name] = page_one ? 1 : 2
         end
 
         url = @template.url_for(@url_params)
+        return url if page_one
         
         if complex
           @url_string = url.sub(%r!([?&amp;]#{CGI.escape param_name}=)#{page}!, '\1@')
           return url
         else
           @url_string = url
-          @url_params[param_name] = 2
+          @url_params[param_name] = 3
           @template.url_for(@url_params).split(//).each_with_index do |char, i|
-            if char == '2' and url[i, 1] == '1'
+            if char == '3' and url[i, 1] == '2'
               @url_string[i] = '@'
               break
             end</diff>
      <filename>lib/will_paginate/view_helpers.rb</filename>
    </modified>
    <modified>
      <diff>@@ -7,6 +7,10 @@ WillPaginate.enable_actionpack
 ActionController::Routing::Routes.draw do |map|
   map.connect 'dummy/page/:page', :controller =&gt; 'dummy'
   map.connect 'dummy/dots/page.:page', :controller =&gt; 'dummy', :action =&gt; 'dots'
+  map.connect 'ibocorp/:page', :controller =&gt; 'ibocorp',
+                               :requirements =&gt; { :page =&gt; /\d+/ },
+                               :defaults =&gt; { :page =&gt; 1 }
+                               
   map.connect ':controller/:action/:id'
 end
 
@@ -79,7 +83,7 @@ class WillPaginate::ViewTestCase &lt; Test::Unit::TestCase
         assert_match pattern, el['href']
         if numbers
           el['href'] =~ pattern
-          pages &lt;&lt; $1.to_i
+          pages &lt;&lt; ($1.nil?? nil : $1.to_i)
         end
       end
 </diff>
      <filename>test/lib/view_test_process.rb</filename>
    </modified>
    <modified>
      <diff>@@ -287,6 +287,15 @@ class ViewTest &lt; WillPaginate::ViewTestCase
     end
   end
 
+  def test_custom_routing_with_first_page_hidden
+    @request.symbolized_path_parameters.update :controller =&gt; 'ibocorp', :action =&gt; nil
+    paginate :page =&gt; 2, :per_page =&gt; 2 do
+      assert_select 'a[href]', 7 do |links|
+        assert_links_match %r{/ibocorp(?:/(\d+))?$}, links, [nil, nil, 3, 4, 5, 6, 3]
+      end
+    end
+  end
+
   ## internal hardcore stuff ##
 
   class LegacyCollection &lt; WillPaginate::Collection</diff>
      <filename>test/view_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>43abd3b63d7040e77e48b356da6ebe4fd5620a65</id>
    </parent>
  </parents>
  <author>
    <name>Mislav Marohni&#263;</name>
    <email>mislav.marohnic@gmail.com</email>
  </author>
  <url>http://github.com/mislav/will_paginate/commit/802d8301923e570bc43ae61320fd02b223e22e8f</url>
  <id>802d8301923e570bc43ae61320fd02b223e22e8f</id>
  <committed-date>2008-05-04T11:42:22-07:00</committed-date>
  <authored-date>2008-05-04T11:42:22-07:00</authored-date>
  <message>another fix with pagination and custom routing: account for that the first page number may be implicit</message>
  <tree>b04272a83f7b6590d8b366d1b926bb11663b7a03</tree>
  <committer>
    <name>Mislav Marohni&#263;</name>
    <email>mislav.marohnic@gmail.com</email>
  </committer>
</commit>
