let url = window.location.href.toString().split(window.location.host)[1].split("?")[0]; let pages = parseInt(document.getElementById("helper").getAttribute("data-pages")); let currentPage = parseInt(findGetParameter("page")); let sort = findGetParameter("sort"); let order = findGetParameter("order"); let sortByInput = document.getElementById("sortBy"); sortByInput.value = sort; let orderInput = document.getElementById("order"); orderInput.value = order; sortByInput.addEventListener("change", function () { window.location.href = url + "?page=" + currentPage + "&sort=" + sortByInput.value + "&order=" + orderInput.value; }) orderInput.addEventListener("change", function() { window.location.href = url + "?page=" + currentPage + "&sort=" + sortByInput.value + "&order=" + orderInput.value; }) document.getElementById('pagination').innerHTML = createPagination(pages, currentPage); function createPagination(pages, page) { let str = '