Get Version



A pagination helper for merb. Useful with dm-is-paginated or with Sequel’s built in pagination.


sudo gem install merb-pagination

The basics

Given a page count and the current page, we generate a set of pagination

We use an inner and outer window into a list of links. For a set of 20 pages with the current page being 10:

outer_window: 1 2 ... 19 20
inner_window: 5 6 7 8 9 10 11 12 13 14

This is totally adjustable, or can be turned off by giving the :inner_window setting a value of nil.

Demonstration of usage

:class => css_class

The CSS class to be given to the paginator div. Defaults to 'paginated'

:prev_label => text_for_previous_link

Defaults to '« Previous '

:next_labe => text_for_next_link

Defaults to ' Next »'

:left_cut_label => text_for_cut

Used when the page numbers need to be cut off to prevent the set of pagination links from being too long. Defaults to '←'

:right_cut_label => text_for_cut

Same as :left_cut_label but for the right side of numbers. Defaults to '→'

:outer_window => number_of_pages

Sets the number of pages to include in the outer ‘window’ Defaults to 2

:inner_window => number_of_pages

Sets the number of pags to include in the inner ‘window’ Defaults to 10

:default_css => use_paginator_provided_css

Use the default CSS provided by the paginator. If you want to do your own custom styling of the paginator from scratch, set this to false. Defaults to true

:page_param => name_of_page_paramiter

Sets the name of the paramiter the paginator uses to return what page is being requested. Defaults to 'page'

:url => url_for_links

Provides the base url to use in the page navigation links. Defaults to ''


<%%= paginate(@current_page, @page_count, :inner_window => 5) %%>

Google Groups / Mailing List

How to submit patches

Read the 8 steps for fixing other people’s code and for section 8b: Submit patch to Google Groups, use the Google Group above.

You can fetch the source from github:

git clone git://

Build and test instructions

cd merb-pagination
rake test
rake install_gem


This code is free to use under the terms of the MIT license.


Comments are welcome, and can be sent via Google Groups

Lori Holden, 12th October 2008
Theme extended from Paul Battley