module Pagy::StandaloneExtra

def pagy_url_for(pagy, page, fragment: 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, fragment: nil, **_)
  return super unless pagy.vars[:url]
  vars         = pagy.vars
  params       = vars[:params].is_a?(Hash) ? vars[:params].clone : {}  # safe when it gets reused
  pagy_set_query_params(page, vars, params)
  params       = vars[:params].(params) if vars[:params].is_a?(Proc)
  query_string = "?#{QueryUtils.build_nested_query(params)}"
  "#{vars[:url]}#{query_string}#{fragment}"
end