<commit_before>var readLine = require ("readline");
var express = require('express');
var compression = require('compression');
var path = require('path');
var favicon = require('serve-favicon');
var morgan = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var session = require('express-session');
var MongoStore = require('connect-mongo')(session);
var LiveSync = require('./livesync');
var log = require('./logger').log;
var options = require('./options-handler').options;
var mongoose = require('mongoose');

var BunyanStream = {
  buffer:'',
  write:function(s) {
    this.buffer += s;
    var tokens = this.buffer.split("\n");
    this.buffer = tokens[tokens.length-1];
    for (var a=0;a<tokens.length-1;a++) {
      log.debug(tokens[a]);
    }
  }
};

exports.init = function() {
  var app = express();
  // Compress content
  app.use(compression({
    threshold: 512
  }));

  // view engine setup
  app.set('views', path.join(__dirname, '../views'));
  app.set('view engine', 'ejs');

  // uncomment after placing your favicon in /public
  //app.use(favicon(__dirname + '/public/favicon.ico'));
  app.use(morgan('dev', {
    stream:BunyanStream
  }));
  app.use(bodyParser.json({limit: '128mb'}));
  app.use(bodyParser.urlencoded({ extended: false }));
  app.use(cookieParser());
  app.use(express.static(path.join(__dirname, '../public'), {maxAge: 0}));
  app.use(session({
    secret: options.sessionSecret,
    saveUninitialized:true,
    resave:true,
    store: new MongoStore({
      mongooseConnection: mongoose.connection
    })
  }));
  // Remember Me middleware
  app.use( function (req, res, next) {
    if ( req.method == 'POST' && req.url == '/login' ) {
      if ( req.body.rememberme ) {<commit_msg>Delete old sessions from the DB<commit_after>var readLine = require ("readline");
var express = require('express');
var compression = require('compression');
var path = require('path');
var favicon = require('serve-favicon');
var morgan = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var session = require('express-session');
var MongoStore = require('connect-mongo')(session);
var LiveSync = require('./livesync');
var log = require('./logger').log;
var options = require('./options-handler').options;
var mongoose = require('mongoose');

var BunyanStream = {
  buffer:'',
  write:function(s) {
    this.buffer += s;
    var tokens = this.buffer.split("\n");
    this.buffer = tokens[tokens.length-1];
    for (var a=0;a<tokens.length-1;a++) {
      log.debug(tokens[a]);
    }
  }
};

exports.init = function() {
  var app = express();
  // Compress content
  app.use(compression({
    threshold: 512
  }));

  // view engine setup
  app.set('views', path.join(__dirname, '../views'));
  app.set('view engine', 'ejs');

  // uncomment after placing your favicon in /public
  //app.use(favicon(__dirname + '/public/favicon.ico'));
  app.use(morgan('dev', {
    stream:BunyanStream
  }));
  app.use(bodyParser.json({limit: '128mb'}));
  app.use(bodyParser.urlencoded({ extended: false }));
  app.use(cookieParser());
  app.use(express.static(path.join(__dirname, '../public'), {maxAge: 0}));
  app.use(session({
    secret: options.sessionSecret,
    saveUninitialized:true,
    resave:true,
    store: new MongoStore({
      mongooseConnection: mongoose.connection,
      clear_interval: 3600
    })
  }));
  // Remember Me middleware
  app.use( function (req, res, next) {
    if ( req.method == 'POST' && req.url == '/login' ) {
      if ( req.body.rememberme ) {
{'fraction_non_alphanumeric': 0.18358291735995563, 'fraction_numerical': 0.0066555740432612314, 'mean_word_length': 3.96831955922865, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2059459', 'n_tokens_mistral': 1168, 'n_tokens_neox': 1156, 'n_words': 253}