<commit_before>
/*
 * GET home page.
 */
var contactCollection;
var home = require('../config/home');
var partner = require('../config/partner');

function extend(dst, src) {
  for (var key in src) {
    if (src.hasOwnProperty(key)) {
      dst[key] = src[key];
    }
  }
}

exports.setDb = function(db) {
  contactCollection = db.collection('contact');;
};

exports.index = function(req, res) {
  var model = {};

  // set cookies
  if (req.cookies.views) {
    model.displayCookie = true;
  } else {
    // set cookie
    model.displayCookie = false;
    // IE8 doesn't support max-age, so have to fallback to expires,
    // though a bit older 
    if (req.secure) {
      res.cookie('views', '1', { expires: new Date(2030, 1, 1), secure: true});
    } else {
      res.cookie('views', '1', { expires: new Date(2030, 1, 1)});
    }
  }

  if (req.path == "/") {
    extend(model, home);
    res.render('index', model);
  } else if (req.path == "/partner") {
    extend(model, partner);
    res.render('index', model);
  } else {
    res.status(404);
    res.render('404', {pageTitle: 'Page Not Found'});
  }
};

exports.contact = function(req, res){
  var data = req.body;

  data.date = (new Date()).toDateString();

  contactCollection.insert(data, function(error, docs) {
    res.json({error: !!error});
  });
};

exports.console = function (req, res) {

  var model = {
      head: {
          title: "console | ten20live"
      }
  };
  res.render('console', model);<commit_msg>fix console page render error<commit_after>
/*
 * GET home page.
 */
var contactCollection;
var home = require('../config/home');
var partner = require('../config/partner');

function extend(dst, src) {
  for (var key in src) {
    if (src.hasOwnProperty(key)) {
      dst[key] = src[key];
    }
  }
}

exports.setDb = function(db) {
  contactCollection = db.collection('contact');;
};

exports.index = function(req, res) {
  var model = {};

  // set cookies
  if (req.cookies.views) {
    model.displayCookie = true;
  } else {
    // set cookie
    model.displayCookie = false;
    // IE8 doesn't support max-age, so have to fallback to expires,
    // though a bit older 
    if (req.secure) {
      res.cookie('views', '1', { expires: new Date(2030, 1, 1), secure: true});
    } else {
      res.cookie('views', '1', { expires: new Date(2030, 1, 1)});
    }
  }

  if (req.path == "/") {
    extend(model, home);
    res.render('index', model);
  } else if (req.path == "/partner") {
    extend(model, partner);
    res.render('index', model);
  } else {
    res.status(404);
    res.render('404', {pageTitle: 'Page Not Found'});
  }
};

exports.contact = function(req, res){
  var data = req.body;

  data.date = (new Date()).toDateString();

  contactCollection.insert(data, function(error, docs) {
    res.json({error: !!error});
  });
};

exports.console = function (req, res) {
  var model = {
      head: {
          title: "console | ten20live"
      }
  };
  res.render('console', model);
{'fraction_non_alphanumeric': 0.18212253096752595, 'fraction_numerical': 0.015400066956812855, 'mean_word_length': 2.8209718670076724, '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': '5730324', 'n_tokens_mistral': 1058, 'n_tokens_neox': 1012, 'n_words': 251}