document.addEventListener("DOMContentLoaded", () => { fetch("isAdmin.php").then(res => res.json().then(json => { if (json.message !== "ok") { window.location.href = "./search.html"; } })); fetch("viewLog.php").then(res => res.json().then(json => { if (json.message === "ok") { for (const key of Object.keys(json.logs[0])) { let header = key.substring(key.indexOf("_") + 1) header = header.charAt(0).toUpperCase() + header.slice(1); document.querySelector("#logTable thead tr").innerHTML += `