<commit_before>var total_tils = 0;

document.querySelectorAll('h3').forEach(element => {
    count_tils(element);
});

function count_tils(element) {
    var sibling;

    if (sibling = element.nextElementSibling) {
        var list = sibling.querySelectorAll('li');
        if (list.length > 0) {
            var descriptor = 'tils';
            if (list.length == 1) {
                descriptor = 'til';
            }

            var text_content = element.textContent + ' (' + list.length + ' ' + descriptor + ')';
            element.textContent = text_content;

            total_tils += list.length;
        }
    }
}

var categories = 0;

document.querySelectorAll('a[href="#categories"] > ul > li').forEach(element => {
    categories += categories + 1;
});

const count = document.createElement('p');
count.textContent = 'A collection of ' + total_tils + ' tils in total, divided on ' + categories + ' categories';

var sidebar = document.getElementById('sidebar');
sidebar.appendChild(count);
<commit_msg>Hmmm I got the DOM wrong, getting tired<commit_after>var total_tils = 0;

document.querySelectorAll('h3').forEach(element => {
    count_tils(element);
});

function count_tils(element) {
    var sibling;

    if (sibling = element.nextElementSibling) {
        var list = sibling.querySelectorAll('li');
        if (list.length > 0) {
            var descriptor = 'tils';
            if (list.length == 1) {
                descriptor = 'til';
            }

            var text_content = element.textContent + ' (' + list.length + ' ' + descriptor + ')';
            element.textContent = text_content;

            total_tils += list.length;
        }
    }
}

var category_count = 0;

document.querySelectorAll('a[href="#categories"]').forEach(element => {
    categories = element.querySelectorAll('ul > li');
    category_count = categories.length;
});

const count = document.createElement('p');
count.textContent = 'A collection of ' + total_tils + ' tils in total, divided on ' + category_count + ' categories';

var sidebar = document.getElementById('sidebar');
sidebar.appendChild(count);

{'fraction_non_alphanumeric': 0.13786591123701605, 'fraction_numerical': 0.005193578847969783, 'mean_word_length': 2.8318264014466545, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2929908', 'n_tokens_mistral': 617, 'n_tokens_neox': 603, 'n_words': 133}