<commit_before>var _ = require('lodash');

exports.getLinks = function getLinks(req, res) {
  var results = ['url\t\tproxy\t\tlastResTime\tavgResTime\tcount'];
  var tmpl = _.template('<%=url%>\t<%=proxy%>\t<%=lastResTime%>\t<%=avgResTime%>\t<%=count%>');

  req.app.get('models').Link.fetchAll(function(err, links) {
    if(err) {
      console.error(err);
    }
    else {
      var defaultLink = {
        proxy: '',
        lastResTime: '',
        avgResTime: '',
        count: 0,
      };

      links.forEach(function(aLink) {
        results.push(
          tmpl(_.defaults(aLink.value, defaultLink))
        );
      });
      res.type('.txt').send(results.join('\n') + '\n');
    }
  });
};

exports.create = function create(req, res) {
  var Link = req.app.get('models').Link;
  var crawler = req.app.get('crawler');

  var link = new Link(req.body);
  link.save(function(err) {
    if (err) {<commit_msg>Fixed get all links<commit_after>var _ = require('lodash');

exports.getLinks = function getLinks(req, res) {
  var results = ['url\t\tproxy\t\tlastResTime\tavgResTime\tcount'];
  var tmpl = _.template('<%=url%>\t<%=proxy%>\t<%=lastResTime%>\t<%=avgResTime%>\t<%=count%>');

  req.app.get('models').Link.fetchAll(function(err, links) {
    if(err) {
      console.error(err);
    }
    else {
      var defaultLink = {
        proxy: '',
        lastResTime: '',
        avgResTime: '',
        count: 0,
      };

      links.forEach(function(aLink) {
        results.push(
          tmpl(_.defaults(aLink.doc, defaultLink))
        );
      });
      res.type('.txt').send(results.join('\n') + '\n');
    }
  });
};

exports.create = function create(req, res) {
  var Link = req.app.get('models').Link;
  var crawler = req.app.get('crawler');

  var link = new Link(req.body);
  link.save(function(err) {
    if (err) {
{'fraction_non_alphanumeric': 0.20021762785636563, 'fraction_numerical': 0.001088139281828074, 'mean_word_length': 2.7076612903225805, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '2848830', 'n_tokens_mistral': 674, 'n_tokens_neox': 653, 'n_words': 97}