class ActiveAdmin::Views::PaginatedCollection

def build_pagination

def build_pagination
  options = { theme: @display_total ? "active_admin" : "active_admin_countless" }
  options[:params] = @params if @params
  options[:param_name] = @param_name if @param_name
  if !@display_total
    # The #paginate method in kaminari will query the resource with a
    # count(*) to determine how many pages there should be unless
    # you pass in the :total_pages option. We issue a query to determine
    # if there is another page or not, but the limit/offset make this
    # query fast.
    offset = collection.offset(collection.current_page * collection.limit_value).limit(1).count
    options[:total_pages] = collection.current_page + offset
    options[:right] = 0
  end
  text_node paginate collection, **options
end