<commit_before>const marked = require('marked');

module.exports = function (req, res, next) {
  const type = req.params.type;
  const asset = req.params.asset;
  const project = res.locals.project;

  if (type !== 'report' || asset) {
    return next();
  }

  res.locals.styles = [
    '/public/gist-info.css'
  ];

  if (project.style === 'technical') {
    res.locals.styles.push('/public/css/technical.css');
  } else {
    res.locals.styles.push('/public/nciea.css');
  }

  res.locals.scripts = [
    '/public/d3.min.js',
    '/public/d3-maximize.min.js',
    '//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML',
    '/public/anchor.min.js'
  ];

  res.locals.title = project.description.split('|')[0];
  res.locals.body = marked(project.report);
  res.locals.gist_subdomain = project.isRepo ? '' : 'gist.';

  res.render('report', {
    partials: {
      infoHeader: 'info-header'
    },
    short_url: project.report_short_url,
    report_url: req.originalUrl.replace('presentation', 'report'),
    presentation_url: req.originalUrl.replace('report', 'presentation'),
    report_link_class: req.originalUrl.indexOf('report') > -1 ? ' active' : '',<commit_msg>Don't crash on missing description<commit_after>const marked = require('marked');

module.exports = function (req, res, next) {
  const type = req.params.type;
  const asset = req.params.asset;
  const project = res.locals.project;

  if (type !== 'report' || asset) {
    return next();
  }

  res.locals.styles = [
    '/public/gist-info.css'
  ];

  if (project.style === 'technical') {
    res.locals.styles.push('/public/css/technical.css');
  } else {
    res.locals.styles.push('/public/nciea.css');
  }

  res.locals.scripts = [
    '/public/d3.min.js',
    '/public/d3-maximize.min.js',
    '//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML',
    '/public/anchor.min.js'
  ];

  res.locals.title = project.description ? project.description.split('|')[0] : '';
  res.locals.body = marked(project.report);
  res.locals.gist_subdomain = project.isRepo ? '' : 'gist.';

  res.render('report', {
    partials: {
      infoHeader: 'info-header'
    },
    short_url: project.report_short_url,
    report_url: req.originalUrl.replace('presentation', 'report'),
    presentation_url: req.originalUrl.replace('report', 'presentation'),
    report_link_class: req.originalUrl.indexOf('report') > -1 ? ' active' : '',
{'fraction_non_alphanumeric': 0.18189300411522633, 'fraction_numerical': 0.0032921810699588477, 'mean_word_length': 3.46875, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5873029', 'n_tokens_mistral': 881, 'n_tokens_neox': 853, 'n_words': 123}