<script>
    $(document).ready(function() {

        $('#checkIsSubmit').on('change', function() {
            window.location.href = '/submit.php?from=parametres-debug&target=submit&actif=' + $('#checkIsSubmit').prop('checked');
        });

        $('#checkIsSql').on('change', function() {
            window.location.href = '/submit.php?from=parametres-debug&target=sql&actif=' + $('#checkIsSql').prop('checked');
        });

        $('#checkIsEmail').on('change', function() {
            window.location.href = '/submit.php?from=parametres-debug&target=email&actif=' + $('#checkIsEmail').prop('checked');
        });

        $('#checkSendIsEmail').on('change', function() {
            window.location.href = '/submit.php?from=parametres-debug&target=send-email&actif=' + $('#checkSendIsEmail').prop('checked');
        });

        $('.toggle-logs').click(function() {
            $('#debugger-logs').slideToggle();
        });

        // Apply syntax highlighting to log entries
        $('.log-entry').each(function() {
            var html = $(this).html();
            html = html.replace(/(\\$\\w+)/g, '<span class=\"variable\">$1</span>');
            html = html.replace(/(\\bfunction\\b)/g, '<span class=\"function\">$1</span>');
            $(this).html(html);
        });
    });
</script>