<commit_before>var express = require('express');
var config = require('./config');
var fs = require("fs");
var utils = require('./utils');

var app = express();

var logglyToken = config.logglyToken;
logglyToken = utils.decrypt(logglyToken);
var logglySubdomain = config.logglySubdomain;
var logglyTags = config.logglyTags;

var winston = require('winston');

require('winston-loggly');
 
winston.add(winston.transports.Loggly, {
    token: logglyToken,
    subdomain: logglySubdomain,
    tags: logglyTags,
    json: true
});

app.use(express.static('public'));

app.all('/', function(req, res, next) {
	winston.log('info', 'Headers object.', { headers: req.headers });
	var ip = req.connection.remoteAddress;
	if (ip == null)
		ip == req.headers['x-forwarded-for'];
	ip = utils.fixIP(ip);
	if (utils.remoteIP(ip)) {
		var object = utils.getLocation(ip);
		console.log(object);
		utils.getLocation(ip).then(function(response) {
			winston.log('info', 'New web request detected.', { location: response, ip: ip });
		});
	}
	next();
});

app.get('/', function(req, res) {
	var model = config.model;
	res.render("home", { model: model }); 
});

var pages = config.pages;

app.get(pages, function(req, res) {
	winston.log('error', "Unauthorized request.", { url: req.url });
	var model = config.model;
	model.error = {
		url: req.url,
		code: 401
	};
	res.status(401).render("error", { model: model });
});

app.use(function(req, res, next) {
	winston.log('error', "Page not found.", { url: req.url });
	var model = config.model;
	model.error = {
		url: req.url,
		code: 404
	};
	res.status(404).render("error", { model: model });
});

app.set('views', __dirname + '/views/pages');
app.set('view engine', 'ejs');

var port = process.env.PORT || 5000;
var httpServer = require('http').createServer(app);
httpServer.listen(port, function() {
    // Listen...
});<commit_msg>Test.<commit_after>var express = require('express');
var config = require('./config');
var fs = require("fs");
var utils = require('./utils');

var app = express();

var logglyToken = config.logglyToken;
logglyToken = utils.decrypt(logglyToken);
var logglySubdomain = config.logglySubdomain;
var logglyTags = config.logglyTags;

var winston = require('winston');

require('winston-loggly');
 
winston.add(winston.transports.Loggly, {
    token: logglyToken,
    subdomain: logglySubdomain,
    tags: logglyTags,
    json: true
});

app.use(express.static('public'));

app.all('/', function(req, res, next) {
	winston.log('info', 'Headers object.', { headers: req.headers });
	winston.log('info', 'Req.ip object.', { object: req.ip });
	winston.log('info', 'Other object.', { object: req.ips });
	var ip = req.connection.remoteAddress;
	if (ip == null)
		ip == req.headers['x-forwarded-for'];
	ip = utils.fixIP(ip);
	if (utils.remoteIP(ip)) {
		var object = utils.getLocation(ip);
		console.log(object);
		utils.getLocation(ip).then(function(response) {
			winston.log('info', 'New web request detected.', { location: response, ip: ip });
		});
	}
	next();
});

app.get('/', function(req, res) {
	var model = config.model;
	res.render("home", { model: model }); 
});

var pages = config.pages;

app.get(pages, function(req, res) {
	winston.log('error', "Unauthorized request.", { url: req.url });
	var model = config.model;
	model.error = {
		url: req.url,
		code: 401
	};
	res.status(401).render("error", { model: model });
});

app.use(function(req, res, next) {
	winston.log('error', "Page not found.", { url: req.url });
	var model = config.model;
	model.error = {
		url: req.url,
		code: 404
	};
	res.status(404).render("error", { model: model });
});

app.set('views', __dirname + '/views/pages');
app.set('view engine', 'ejs');

var port = process.env.PORT || 5000;
var httpServer = require('http').createServer(app);
httpServer.listen(port, function() {
    // Listen...
});
{'fraction_non_alphanumeric': 0.19688311688311688, 'fraction_numerical': 0.008311688311688312, 'mean_word_length': 4.386013986013986, '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': '840077', 'n_tokens_mistral': 1399, 'n_tokens_neox': 1336, 'n_words': 296}