var pagination_bars = document.getElementsByClassName("pagination");
for (let i = 0; i <pagination_bars.length;i++){
pagination_bars[i].innerHTML = "";
if (page_num != 1) {
var prev_item = `<liclass="page-item"><buttonname="page"value="${prev}"class="page-link"onclick="offset_page(-1)"><imgsrc="/static/svg/chevron-left.svg"></button></li>`;
pagination_bars[i].innerHTML += prev_item;
}
first_active = "";
if (page_num == 1) {first_active = "active"}
var first_item = `<liclass="page-item ${first_active}"><buttonname="page"value="1"class="page-link"onclick="go_to_page(1)">1</button></li>`;
pagination_bars[i].innerHTML += first_item;
if (min > 2) {pagination_bars[i].innerHTML += "...";}
for (x = min; x <max;x++){
active = "";
if (page_num == x) {active = "active"}
var item = `<liclass="page-item ${active}"><buttonname="page"value="${x}"class="page-link"onclick="go_to_page(${x})">${x}</button></li>`;
pagination_bars[i].innerHTML += item;
}
if (max <page_count){pagination_bars[i].innerHTML+="...";}
last_active = "";
if (page_num == page_count) {last_active = "active"}
var last_item = `<liclass="page-item ${last_active}"><buttonname="page"value="1"class="page-link"onclick="go_to_page(${page_count})">${page_count}</button></li>`;
pagination_bars[i].innerHTML += last_item;
if (page_num != page_count) {
var next_item = `<liclass="page-item"><buttonname="page"value="${next}"class="page-link"onclick="offset_page(1)"><imgsrc="/static/svg/chevron-right.svg"></button></li>`;