<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,9 @@
+== 2.2.2, released 2008-04-21
+
+* Add support for page parameter in custom routes like &quot;/foo/page/2&quot;
+* Change output of &quot;page_entries_info&quot; on single-page collection and erraneous
+  output with empty collection as reported by Tim Chater
+  
 == 2.2.1, released 2008-04-08
 
 * take less risky path when monkeypatching named_scope; fix that it no longer</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -114,7 +114,7 @@ contributions or just simply awesome ideas:
 Chris Wanstrath, Dr. Nic Williams, K. Adam Christensen, Mike Garey, Bence
 Golda, Matt Aimonetti, Charles Brian Quinn, Desi McAdam, James Coglan, Matijs
 van Zuijlen, Maria, Brendan Ribera, Todd Willey, Bryan Helmkamp, Jan Berkel,
-Lourens Naud&#233;, Rick Olson.
+Lourens Naud&#233;, Rick Olson, Russell Norris.
 
 
 == Usable pagination in the UI</diff>
      <filename>README.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -2,7 +2,7 @@ module WillPaginate #:nodoc:
   module VERSION #:nodoc:
     MAJOR = 2
     MINOR = 2
-    TINY  = 1
+    TINY  = 2
 
     STRING = [MAJOR, MINOR, TINY].join('.')
   end</diff>
      <filename>lib/will_paginate/version.rb</filename>
    </modified>
    <modified>
      <diff>@@ -132,11 +132,19 @@ module WillPaginate
     #   &lt;%= page_entries_info @posts %&gt;
     #   #-&gt; Displaying entries 6 - 10 of 26 in total
     def page_entries_info(collection)
-      %{Displaying entries &lt;b&gt;%d&amp;nbsp;-&amp;nbsp;%d&lt;/b&gt; of &lt;b&gt;%d&lt;/b&gt; in total} % [
-        collection.offset + 1,
-        collection.offset + collection.length,
-        collection.total_entries
-      ]
+      if collection.total_pages &lt; 2
+        case collection.size
+        when 0; 'No entries found'
+        when 1; 'Displaying &lt;b&gt;1&lt;/b&gt; entry'
+        else;   &quot;Displaying &lt;b&gt;all #{collection.size}&lt;/b&gt; entries&quot;
+        end
+      else
+        %{Displaying entries &lt;b&gt;%d&amp;nbsp;-&amp;nbsp;%d&lt;/b&gt; of &lt;b&gt;%d&lt;/b&gt; in total} % [
+          collection.offset + 1,
+          collection.offset + collection.length,
+          collection.total_entries
+        ]
+      end
     end
 
     def self.total_pages_for_collection(collection) #:nodoc:
@@ -272,7 +280,7 @@ module WillPaginate
         end
 
         url = @template.url_for(@url_params)
-        @url_string = url.sub(/([?&amp;]#{CGI.escape param_name}=)#{page}/, '\1@')
+        @url_string = url.sub(%r!([?&amp;/]#{CGI.escape param_name}[=/])#{page}!, '\1@')
         return url
       end
       @url_string.sub '@', page.to_s</diff>
      <filename>lib/will_paginate/view_helpers.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,15 +5,19 @@ require 'will_paginate'
 WillPaginate.enable_actionpack
 
 ActionController::Routing::Routes.draw do |map|
+  map.connect 'dummy/page/:page', :controller =&gt; 'dummy'
   map.connect ':controller/:action/:id'
 end
 
 ActionController::Base.perform_caching = false
 
 class DummyRequest
+  attr_accessor :symbolized_path_parameters
+  
   def initialize
     @get = true
     @params = {}
+    @symbolized_path_parameters = { :controller =&gt; 'foo', :action =&gt; 'bar' }
   end
   
   def get?
@@ -24,10 +28,6 @@ class DummyRequest
     @get = false
   end
 
-  def symbolized_path_parameters
-    { :controller =&gt; 'foo', :action =&gt; 'bar' }
-  end
-
   def relative_url_root
     ''
   end</diff>
      <filename>test/lib/view_test_process.rb</filename>
    </modified>
    <modified>
      <diff>@@ -156,6 +156,19 @@ class ViewTest &lt; Test::Unit::TestCase
     assert_equal %{Displaying entries &lt;b&gt;25&amp;nbsp;-&amp;nbsp;26&lt;/b&gt; of &lt;b&gt;26&lt;/b&gt; in total},
       @html_result
   end
+
+  def test_page_entries_info_with_single_page_collection
+    @template = '&lt;%= page_entries_info collection %&gt;'
+    
+    paginate(('a'..'d').to_a.paginate(:page =&gt; 1, :per_page =&gt; 5))
+    assert_equal %{Displaying &lt;b&gt;all 4&lt;/b&gt; entries}, @html_result
+    
+    paginate(['a'].paginate(:page =&gt; 1, :per_page =&gt; 5))
+    assert_equal %{Displaying &lt;b&gt;1&lt;/b&gt; entry}, @html_result
+    
+    paginate([].paginate(:page =&gt; 1, :per_page =&gt; 5))
+    assert_equal %{No entries found}, @html_result
+  end
   
   ## parameter handling in page links ##
   
@@ -207,6 +220,15 @@ class ViewTest &lt; Test::Unit::TestCase
     end
   end
 
+  def test_custom_routing_page_param
+    @request.symbolized_path_parameters.update :controller =&gt; 'dummy', :action =&gt; nil
+    paginate :per_page =&gt; 2 do
+      assert_select 'a[href]', 6 do |links|
+        assert_links_match %r{/page/(\d+)$}, links, [2, 3, 4, 5, 6, 2]
+      end
+    end
+  end
+
   ## internal hardcore stuff ##
 
   class LegacyCollection &lt; WillPaginate::Collection
@@ -294,14 +316,22 @@ class ViewTest &lt; Test::Unit::TestCase
       })
     end
 
-    def assert_links_match pattern, links = nil
+    def assert_links_match pattern, links = nil, numbers = nil
       links ||= assert_select 'div.pagination a[href]' do |elements|
         elements
       end
+
+      pages = [] if numbers
       
       links.each do |el|
         assert_match pattern, el['href']
+        if numbers
+          el['href'] =~ pattern
+          pages &lt;&lt; $1.to_i
+        end
       end
+
+      assert_equal pages, numbers, &quot;page numbers don't match&quot; if numbers
     end
 
     def assert_no_links_match pattern</diff>
      <filename>test/view_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>947bc8d3c843771cbef38e0a3c53684d49160c22</id>
    </parent>
    <parent>
      <id>4d2da56949b66f838d932724ca40bf7f93627b1f</id>
    </parent>
  </parents>
  <author>
    <name>Matt Aimonetti</name>
    <email>mattaimonetti@gmail.com</email>
  </author>
  <url>http://github.com/mattetti/will_paginate/commit/96d1adda480430b44d33c6c413b44acc639a8f08</url>
  <id>96d1adda480430b44d33c6c413b44acc639a8f08</id>
  <committed-date>2008-04-21T21:40:06-07:00</committed-date>
  <authored-date>2008-04-21T21:40:06-07:00</authored-date>
  <message>Merge branch 'master' of git://github.com/mislav/will_paginate</message>
  <tree>8fa987ba00f8dd1ddaffa0ba441d4750fb258891</tree>
  <committer>
    <name>Matt Aimonetti</name>
    <email>mattaimonetti@gmail.com</email>
  </committer>
</commit>
