<commit_before>var path = require("path");

exports.middleware = {

  emptyMiddleware: function(req, res, next) {
    next();
  },
    
  setApiParams: function(req, res, next) {

    var apiUrl = ((req.headers["x-forwarded-proto"] != null) ? req.headers["x-forwarded-proto"] : req.protocol)+"://"+req.headers.host;
    var rtrnCount = (req.query.count == null) ? 1 : parseInt(req.query.count);
    var rtrnOffset = (req.query.offset == null) ? 0 : parseInt(req.query.offset);

    var contentType = path.extname(req.path).trim().substr(1);
    if (contentType.trim().length == 0) { contentType = "json"; }
    req.url = req.url.replace("."+contentType,"");

    req.rfcx = {
      api_url: apiUrl,
      count: rtrnCount,
      offset: rtrnOffset,
      content_type: contentType
    };

    next();
  },

}<commit_msg>adding start/end timestamp parameters<commit_after>var path = require("path");

exports.middleware = {

  emptyMiddleware: function(req, res, next) {
    next();
  },
    
  setApiParams: function(req, res, next) {

    var apiUrl = ((req.headers["x-forwarded-proto"] != null) ? req.headers["x-forwarded-proto"] : req.protocol)+"://"+req.headers.host;
    var paramCount = (req.query.count == null) ? 1 : parseInt(req.query.count);
    var paramOffset = (req.query.offset == null) ? 0 : parseInt(req.query.offset);

    var paramStart = (req.query.start == null) ? null : (new Date(""+req.query.start));
    var paramEnd = (req.query.end == null) ? null : (new Date(""+req.query.end));

    var contentType = path.extname(req.path).trim().substr(1);
    if (contentType.trim().length == 0) { contentType = "json"; }
    req.url = req.url.replace("."+contentType,"");

    req.rfcx = {
      api_url: apiUrl,
      count: paramCount,
      offset: paramOffset,
      start: paramStart,
      end: paramEnd,
      content_type: contentType
    };

    next();
  },

}
{'fraction_non_alphanumeric': 0.18090185676392573, 'fraction_numerical': 0.004244031830238726, 'mean_word_length': 3.2098214285714284, 'pattern_counts': {'":': 2, '<': 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': '3049497', 'n_tokens_mistral': 649, 'n_tokens_neox': 636, 'n_words': 123}