def pages_to_link_to(paginated_set, options = {})
      current, last = paginated_set.current_page, paginated_set.page_count
      max = peiji_san_option(:max_visible, options)
      separator = peiji_san_option(:separator, options)
      
      if last <= max
        (1..last).to_a
      elsif current <= ((max / 2) + 1)
        (1..(max - 2)).to_a + [separator, last]
      elsif current >= (last - (max / 2))
        [1, separator, *((last - (max - 3))..last)]
      else
        offset = (max - 4) / 2
        [1, separator] + ((current - offset)..(current + offset)).to_a + [separator, last]
      end
    end
def pages_to_link_to(paginated_set, options = {})
      current, last = paginated_set.current_page, paginated_set.page_count
      max = peiji_san_option(:max_visible, options)
      separator = peiji_san_option(:separator, options)
      
      if last <= max
        (1..last).to_a
      elsif current <= ((max / 2) + 1)
        (1..(max - 2)).to_a + [separator, last]
      elsif current >= (last - (max / 2))
        [1, separator, *((last - (max - 3))..last)]
      else
        offset = (max - 4) / 2
        [1, separator] + ((current - offset)..(current + offset)).to_a + [separator, last]
      end
    end
Returns an array of pages to link to. This array includes the separator, so
 make sure to keep this in mind when iterating over the array and creating
 links.

 For consistency’s sake, it is adviced to use an odd number for
 <tt>:max_visible</tt>.

 Options:
   [:max_visible]
     The maximum amount of elements in the array, this includes the
     separator(s). Defaults to 11.
   [:separator]
     The separator string used to indicate a range between the first or last
     page and the ones surrounding the current page.

   collection = Model.all.page(40)
   collection.page_count # => 80

   pages_to_link_to(collection) # => [1, '…', 37, 38, 39, 40, 41, 42, 43, '…', 80]