module Pagy::StandaloneExtra

def pagy_url_for(pagy, page, absolute: nil)

If there is a defined pagy.vars[:url] variable it does not need the params method nor Rack.
it works exactly as the regular #pagy_url_for, relying on the params method and Rack.
Return the URL for the page. If there is no pagy.vars[:url]
def pagy_url_for(pagy, page, absolute: nil)
  vars = pagy.vars
  return super unless (url = vars[:url])
  params                     = vars[:params].clone  # safe when it gets reused
  params[vars[:page_param]]  = page
  params[vars[:items_param]] = vars[:items] if vars[:items_extra]
  query_string = "?#{QueryUtils.build_nested_query(pagy_massage_params(params))}"
  "#{url}#{query_string}#{vars[:fragment]}"
end