p = textarea.scrollHeight
        })
        .catch(error => {
          console.error('Error loading the file:', error);
          alert('Could not load the file.');
        });
    }

    function saveFile() {
      let content = document.getElementById('editor').value;
      
      fetch('/cgi-bin/save_log.cgi', {
        method: 'POST',
        headers: {
          'Content-Type': 'text/plain'
        },
        body: content
      })
      .then(response => {
        if (!response.ok) {
          throw