<commit_before>function updateStats() {
	var requestURI = "json.php";
	
	new Ajax.Request(requestURI, {
		onSuccess: function(response) {
			var stats = new Stats(response.responseJSON);
			Stats.instance = stats;
			
			$("interface").update(stats.interface);
			$("updated").update(stats.updated);
			
			var colors = ["127fef", "ef8f12"];
			
			/**
			 * All-time total bandwidth usage
			**/
			var sent = stats.traffic.total.sent;
			var received = stats.traffic.total.received;
			var unit = [sent, received].sortBy(function(t) { return t.getBytes(); }).last().appropriateUnit();
			var data = [sent, received].map(function(t) { return t.toUnit(unit); });
			var range = Graph.getRangeFor(data);
			
			var g = new Graph({
				cht: "bhg",
				chs: "600x150",
				chd: "t:" + data.join("|"),
				chdl: "Sent|Received",
				chtt: "All-Time",
				chco: colors.join(","),
				chbh: "a",
				chxt: "x,x",
				chxl: "1:|" + unit.getName().capitalize(),
				chxp: "1,50",
				chds: range.join(","),
				chxr: [0, range[0], range[1]].join(","),
				chm: "N*f2* " + unit.getLabel() + ",666666,0,,11,0,l:5:|N*f2* " + unit.getLabel() + ",666666,1,,11,0,l:5:",
				chg: "10,0,1,5"
			});
			$("graph-total").update(g.getImageTag());
			
			/**
			 * Hourly bandwidth usage
			**/
			var hourly = stats.traffic.hourly;
			
			var sentUnit = hourly.map(function(h) {
				return h.sent;
			}).sortBy(function(s) {
				return s.getBytes();
			}).last().appropriateUnit();
			
			var sentData = Graph.fillData(hourly.map(function(h) {
				return h.sent.toUnit(sentUnit);
			}), 24, 0);
			var sentYRange = Graph.getRangeFor(sentData);
			
			var recvData = Graph.fillData(hourly.map(function(h) {
				return h.received.toUnit(sentUnit);
			}), 24, 0);
			
			g = new Graph({
				cht: "lc",
				chtt: "Last 24 Hours",
				chco: colors.join(","),
				chs: "600x300",
				chd: "t:" + [sentData, recvData].map(function(a) { return a.join(","); }).join("|"),
				chdl: "Sent|Received",
				chxt: "x,x,y,y",
				chxr: [[0,0,24], [1,0,24], [2, sentYRange[0], sentYRange[1], 5]].map(function(a){return a.join(",");}).join("|"),
				chxl: "1:|Hours Ago|3:|" + sentUnit.getLabel(),
				chxp: "1,12|3,50",
				chds: sentYRange.join(","),
				// chm: "N*f1* "+sentUnit.getLabel()+",666666,0,2:22:2,11,0,h",
				chg: "4.16,25,1,5"
			});
			$("graph-hourly").update(g.getImageTag());
			
			/**
			 * Daily bandwidth usage
			**/
			var daily = stats.traffic.daily;
			
			sentUnit = daily.map(function(d) {
				return d.sent;
			}).sortBy(function(s) {
				return s.getBytes();
			}).last().appropriateUnit();
			
			sentData = Graph.fillData(daily.map(function(d) {
				return d.sent.toUnit(sentUnit);
			}), 31, 0);
			console.log(Object.inspect(sentData));
			sentYRange = Graph.getRangeFor(sentData);
			
			recvData = Graph.fillData(daily.map(function(d) {
				return d.received.toUnit(sentUnit);
			}), 31, 0);
			
			g = new Graph({
				cht: "lc",
				chtt: "Last Month",
				chco: colors.join(","),
				chs: "600x300",
				chd: "t:" + [sentData, recvData].map(function(a) { return a.join(","); }).join("|"),
				chdl: "Sent|Received",
				chxt: "x,x,y,y",
				chxr: [[0,0,31,2], [1,0,31], [2, sentYRange[0], sentYRange[1]]].map(function(a){return a.join(",");}).join("|"),
				chxl: "1:|Days Ago|3:|" + sentUnit.getLabel(),
				chxp: "1,15|3,50",
				chds: sentYRange.join(","),
				chg: "3.225,25,1,5"
			});
			$("graph-daily").update(g.getImageTag());
			
			/**<commit_msg>Small JavaScript syntax consistency updates<commit_after>function updateStats() {
	var requestURI = "json.php";
	
	new Ajax.Request(requestURI, {
		onSuccess: function(response) {
			var stats = new Stats(response.responseJSON);
			Stats.instance = stats;
			
			$("interface").update(stats.interface);
			$("updated").update(stats.updated);
			
			var colors = ["127fef", "ef8f12"];
			
			/**
			 * All-time total bandwidth usage
			**/
			var sent = stats.traffic.total.sent;
			var received = stats.traffic.total.received;
			var unit = [sent, received].sortBy(function(t) { return t.getBytes(); }).last().appropriateUnit();
			var data = [sent, received].map(function(t) { return t.toUnit(unit); });
			var range = Graph.getRangeFor(data);
			
			var g = new Graph({
				cht: "bhg",
				chs: "600x150",
				chd: "t:" + data.join("|"),
				chdl: "Sent|Received",
				chtt: "All-Time",
				chco: colors.join(","),
				chbh: "a",
				chxt: "x,x",
				chxl: "1:|" + unit.getName().capitalize(),
				chxp: "1,50",
				chds: range.join(","),
				chxr: [0, range[0], range[1]].join(","),
				chm: "N*f2* " + unit.getLabel() + ",666666,0,,11,0,l:5:|N*f2* " + unit.getLabel() + ",666666,1,,11,0,l:5:",
				chg: "10,0,1,5"
			});
			$("graph-total").update(g.getImageTag());
			
			/**
			 * Hourly bandwidth usage
			**/
			var hourly = stats.traffic.hourly;
			
			var sentUnit = hourly.map(function(h) {
				return h.sent;
			}).sortBy(function(s) {
				return s.getBytes();
			}).last().appropriateUnit();
			
			var sentData = Graph.fillData(hourly.map(function(h) {
				return h.sent.toUnit(sentUnit);
			}), 24, 0);
			var sentYRange = Graph.getRangeFor(sentData);
			
			var recvData = Graph.fillData(hourly.map(function(h) {
				return h.received.toUnit(sentUnit);
			}), 24, 0);
			
			g = new Graph({
				cht: "lc",
				chtt: "Last 24 Hours",
				chco: colors.join(","),
				chs: "600x300",
				chd: "t:" + [sentData, recvData].map(function(a){return a.join(",");}).join("|"),
				chdl: "Sent|Received",
				chxt: "x,x,y,y",
				chxr: [[0,0,24], [1,0,24], [2, sentYRange[0], sentYRange[1], 5]].map(function(a){return a.join(",");}).join("|"),
				chxl: "1:|Hours Ago|3:|" + sentUnit.getLabel(),
				chxp: "1,12|3,50",
				chds: sentYRange.join(","),
				// chm: "N*f1* "+sentUnit.getLabel()+",666666,0,2:22:2,11,0,h",
				chg: "4.16,25,1,5"
			});
			$("graph-hourly").update(g.getImageTag());
			
			/**
			 * Daily bandwidth usage
			**/
			var daily = stats.traffic.daily;
			
			sentUnit = daily.map(function(d) {
				return d.sent;
			}).sortBy(function(s) {
				return s.getBytes();
			}).last().appropriateUnit();
			
			sentData = Graph.fillData(daily.map(function(d) {
				return d.sent.toUnit(sentUnit);
			}), 31, 0);
			console.log(Object.inspect(sentData));
			sentYRange = Graph.getRangeFor(sentData);
			
			recvData = Graph.fillData(daily.map(function(d) {
				return d.received.toUnit(sentUnit);
			}), 31, 0);
			
			g = new Graph({
				cht: "lc",
				chtt: "Last Month",
				chco: colors.join(","),
				chs: "600x300",
				chd: "t:" + [sentData, recvData].map(function(a){return a.join(",");}).join("|"),
				chdl: "Sent|Received",
				chxt: "x,x,y,y",
				chxr: [[0,0,31,2], [1,0,31], [2, sentYRange[0], sentYRange[1]]].map(function(a){return a.join(",");}).join("|"),
				chxl: "1:|Days Ago|3:|" + sentUnit.getLabel(),
				chxp: "1,15|3,50",
				chds: sentYRange.join(","),
				chg: "3.225,25,1,5"
			});
			$("graph-daily").update(g.getImageTag());
			
			/**
{'fraction_non_alphanumeric': 0.22532374100719424, 'fraction_numerical': 0.04143884892086331, 'mean_word_length': 3.2933909820877085, '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': '314619', 'n_tokens_mistral': 3437, 'n_tokens_neox': 2730, 'n_words': 472}