const urlSearchParams = new URLSearchParams(window.location.search);
const params = Object.fromEntries(urlSearchParams.entries());
console.log(params);
console.log(location.href);
const pageform = document.querySelector(".form");

function pagination(page) {
 
  const newUri = updateQueryStringParameter(location.href, "page", page);
  console.log(newUri);
  pageform.action=newUri;
  window.location.href=newUri
}
const updateQueryStringParameter = (uri, key, value) => {
  var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
  var separator = uri.indexOf("?") !== -1 ? "&" : "?";
  if (uri.match(re)) {
    return uri.replace(re, "$1" + key + "=" + value + "$2");
  } else {
    return uri + separator + key + "=" + value;
  }
};
