v.innerText = "";

    tocDiv.innerText = ''; // Clear previous titles
    let ascindex = 0;
    currdbidxs = [];

    if (search != "") {
        if (!document.getElementById('useregex').checked) {
            search = escapeRegExp(search);
        }
    }

    db.forEach((item, index) => {
        const titleDiv = document.createElement('div');

        let rendered = renderPage(item,false);
        let len = rendered.text.length;
        let matchescount = 0;

        if (minlen != "")