<commit_before>package xrmoddir

import (
	"bytes"
	"html/template"
	"io"
	"log"
	"net/http"
)

func setHandlers(s *Server) error {
	s.Get("/", index)
	s.Get("/about", about)
	return nil
}

var buf bytes.Buffer

func index(
	w http.ResponseWriter,
	t *template.Template,
	l *log.Logger,
) {
	buf.Reset()
	c := NewContent()
	c.Content = "index.tmpl.html"
	err := t.ExecuteTemplate(&buf, "layout_main.tmpl.html", c)
	if err != nil {
		log.Printf("Template error: %v", err)
		w.WriteHeader(http.StatusInternalServerError)
		return
	}
	io.Copy(w, &buf)
}

func about(
	t *template.Template,
	l *log.Logger,
) (respCode int, body string) {
	respCode = http.StatusOK
	buf.Reset()
	c := NewContent()
	c.Content = "about.tmpl.html"
	err := t.ExecuteTemplate(&buf, "layout_main.tmpl.html", c)
	if err != nil {
		log.Printf("Template error: %v", err)
		respCode = http.StatusInternalServerError
		return
	}
	body = buf.String()
	return
}<commit_msg>Fix: handlers will use local buffer<commit_after>package xrmoddir

import (
	"bytes"
	"html/template"
	"io"
	"log"
	"net/http"
)

func setHandlers(s *Server) error {
	s.Get("/", index)
	s.Get("/about", about)
	return nil
}

// The Index Page
func index(
	w http.ResponseWriter,
	t *template.Template,
	l *log.Logger,
) {
	var buf bytes.Buffer
	c := NewContent()
	c.Content = "index.tmpl.html"
	err := t.ExecuteTemplate(&buf, "layout_main.tmpl.html", c)
	if err != nil {
		log.Printf("Template error: %v", err)
		w.WriteHeader(http.StatusInternalServerError)
		return
	}
	io.Copy(w, &buf)
}

// About page
func about(
	t *template.Template,
	l *log.Logger,
) (respCode int, body string) {
	var buf bytes.Buffer
	respCode = http.StatusOK
	buf.Reset()
	c := NewContent()
	c.Content = "about.tmpl.html"
	err := t.ExecuteTemplate(&buf, "layout_main.tmpl.html", c)
	if err != nil {
		log.Printf("Template error: %v", err)
		respCode = http.StatusInternalServerError
		return
	}
	body = buf.String()
	return
}
{'fraction_non_alphanumeric': 0.15919629057187018, 'fraction_numerical': 0.0, 'mean_word_length': 3.94147582697201, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1845452', 'n_tokens_mistral': 772, 'n_tokens_neox': 761, 'n_words': 178}