def will_paginate(collection, options = {})
      # early exit if there is nothing to render
      return nil unless collection.total_pages > 1

      options = WillPaginate::ViewHelpers.pagination_options.merge(options)

      options[:previous_label] ||= will_paginate_translate(:previous_label) { '&#8592; Previous' }
      options[:next_label]     ||= will_paginate_translate(:next_label) { 'Next &#8594;' }

      # get the renderer instance
      renderer = case options[:renderer]
      when nil
        raise ArgumentError, ":renderer not specified"
      when String
        klass = if options[:renderer].respond_to? :constantize then options[:renderer].constantize
          else Object.const_get(options[:renderer]) # poor man's constantize
          end
        klass.new
      when Class then options[:renderer].new
      else options[:renderer]
      end
      # render HTML for pagination
      renderer.prepare collection, options, self
      output = renderer.to_html
      output = output.html_safe if output.respond_to?(:html_safe)
      output
    end
def will_paginate(collection, options = {})
      # early exit if there is nothing to render
      return nil unless collection.total_pages > 1

      options = WillPaginate::ViewHelpers.pagination_options.merge(options)

      options[:previous_label] ||= will_paginate_translate(:previous_label) { '&#8592; Previous' }
      options[:next_label]     ||= will_paginate_translate(:next_label) { 'Next &#8594;' }

      # get the renderer instance
      renderer = case options[:renderer]
      when nil
        raise ArgumentError, ":renderer not specified"
      when String
        klass = if options[:renderer].respond_to? :constantize then options[:renderer].constantize
          else Object.const_get(options[:renderer]) # poor man's constantize
          end
        klass.new
      when Class then options[:renderer].new
      else options[:renderer]
      end
      # render HTML for pagination
      renderer.prepare collection, options, self
      output = renderer.to_html
      output = output.html_safe if output.respond_to?(:html_safe)
      output
    end
Returns HTML representing page links for a WillPaginate::Collection-like object.
 In case there is no more than one page in total, nil is returned.

 ==== Options
 * <tt>:class</tt> -- CSS class name for the generated DIV (default: "pagination")
 * <tt>:previous_label</tt> -- default: "« Previous"
 * <tt>:next_label</tt> -- default: "Next »"
 * <tt>:inner_window</tt> -- how many links are shown around the current page (default: 4)
 * <tt>:outer_window</tt> -- how many links are around the first and the last page (default: 1)
 * <tt>:link_separator</tt> -- string separator for page HTML elements (default: single space)
 * <tt>:param_name</tt> -- parameter name for page number in URLs (default: <tt>:page</tt>)
 * <tt>:params</tt> -- additional parameters when generating pagination links
   (eg. <tt>:controller => "foo", :action => nil</tt>)
 * <tt>:renderer</tt> -- class name, class or instance of a link renderer (default in Rails:
   <tt>WillPaginate::ActionView::LinkRenderer</tt>)
 * <tt>:page_links</tt> -- when false, only previous/next links are rendered (default: true)
 * <tt>:container</tt> -- toggles rendering of the DIV container for pagination links, set to
   false only when you are rendering your own pagination markup (default: true)

 All options not recognized by will_paginate will become HTML attributes on the container
 element for pagination links (the DIV). For example:

   <%= will_paginate @posts, :style => 'color:blue' %>

 will result in:

   <div class="pagination" style="color:blue"> ... </div>