<commit_before>var fs = require('fs');
var express = require('express');
var app = express();
var json2csv = require('json2csv');
var _ = require('underscore');
var favicon = require('serve-favicon');
var hbs = require('hbs');

var db = require('./db')();
var report = require('./report')
var port = 5070;

var fields = ['invite_type','talk_type','event_name','event_location','travel_type','ticket_type','fee','currency','travel_assistance','travel_assistance_by_employer','time_off','speaking_slot','speaking_slot_unit','prep_time','prep_time_unit','experience','gender','expertise','speaking_years','event_type','additional_info'];
var fieldNames =['Invite Type','Talk Type','Event Name','Event Location','Travel Type','Ticket Type','Fee','Currency','Travel Assistance','Travel Assistance by Employer','Time Off','Speaking Slot','Speaking Slot Unit','Prep Time','Prep Time Unit','Experience','Gender','Expertise','Speaking Years','Event Type','Additional Info'];

function submissionDate(){
  var monthNames = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ];
  var now = new Date();
  var date = now.getDate()<10? 'early': now.getDate()>20 ? 'late': 'mid';
  var month = monthNames[now.getMonth()];
  var year = now.getFullYear();
  return date+' '+month +' '+ year;
}

/*
* express server setup
*/
app.set('view engine', 'html');
app.engine('html', hbs.__express);
app.use(favicon(__dirname + '/public/img/favicon.ico'));
hbs.registerPartial('ga', fs.readFileSync(__dirname + '/views/ga.html', 'utf8'));
hbs.registerPartial('footer', fs.readFileSync(__dirname + '/views/footer.html', 'utf8'));
app.use(express.json());
app.use(express.urlencoded());
app.use(express.multipart());
app.use(express.static(__dirname + '/public'));
app.listen(port);

app.get('/', function(req, res) {
  res.render('index');
});
<commit_msg>Check if ga.html exists before registering it<commit_after>var fs = require('fs');
var express = require('express');
var app = express();
var json2csv = require('json2csv');
var _ = require('underscore');
var favicon = require('serve-favicon');
var hbs = require('hbs');

var db = require('./db')();
var report = require('./report')
var port = 5070;

var fields = ['invite_type','talk_type','event_name','event_location','travel_type','ticket_type','fee','currency','travel_assistance','travel_assistance_by_employer','time_off','speaking_slot','speaking_slot_unit','prep_time','prep_time_unit','experience','gender','expertise','speaking_years','event_type','additional_info'];
var fieldNames =['Invite Type','Talk Type','Event Name','Event Location','Travel Type','Ticket Type','Fee','Currency','Travel Assistance','Travel Assistance by Employer','Time Off','Speaking Slot','Speaking Slot Unit','Prep Time','Prep Time Unit','Experience','Gender','Expertise','Speaking Years','Event Type','Additional Info'];

function submissionDate(){
  var monthNames = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ];
  var now = new Date();
  var date = now.getDate()<10? 'early': now.getDate()>20 ? 'late': 'mid';
  var month = monthNames[now.getMonth()];
  var year = now.getFullYear();
  return date+' '+month +' '+ year;
}

/*
* express server setup
*/
app.set('view engine', 'html');
app.engine('html', hbs.__express);
app.use(favicon(__dirname + '/public/img/favicon.ico'));
fs.exists(__dirname + '/views/ga.html', function (exists) {
  if(exists){ hbs.registerPartial('ga', fs.readFileSync(__dirname + '/views/ga.html', 'utf8')); }
});
hbs.registerPartial('footer', fs.readFileSync(__dirname + '/views/footer.html', 'utf8'));
app.use(express.json());
app.use(express.urlencoded());
app.use(express.multipart());
app.use(express.static(__dirname + '/public'));
app.listen(port);

app.get('/', function(req, res) {
  res.render('index');
});

{'fraction_non_alphanumeric': 0.21512519161982627, 'fraction_numerical': 0.0061318344404701075, 'mean_word_length': 7.719376391982182, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2411856', 'n_tokens_mistral': 1297, 'n_tokens_neox': 1197, 'n_words': 251}