<commit_before>var express = require('express');
var models = require('news-wires-db');
var router = express.Router();

const NEWS_ITEMS_PER_PAGE = 30

router.get('/:page?', function(req, res, next) {
  let page;

  if (!req.params.page) {
    page = 1;
  }
  else {
    page = parseInt(req.params.page);
  }

  if (isNaN(page)) {
    res.render('error', { message: "Error", error: new Error('Invalid page') });
  }
  else {
    models.NewsItem.findAll({
      include: [
        { model: models.NewsSource }
      ],
      limit: NEWS_ITEMS_PER_PAGE,
      offset: NEWS_ITEMS_PER_PAGE * (page - 1),
      order: [
        ['createdAt', 'DESC']
      ]
    }).then((newsItems) => {
      res.render('index', { newsItems: newsItems, page: page, title: 'news-wires'});
    });
  }
});

module.exports = router;<commit_msg>chore: changes page title to 'news'<commit_after>var express = require('express');
var models = require('news-wires-db');
var router = express.Router();

const NEWS_ITEMS_PER_PAGE = 30

router.get('/:page?', function(req, res, next) {
  let page;

  if (!req.params.page) {
    page = 1;
  }
  else {
    page = parseInt(req.params.page);
  }

  if (isNaN(page)) {
    res.render('error', { message: "Error", error: new Error('Invalid page') });
  }
  else {
    models.NewsItem.findAll({
      include: [
        { model: models.NewsSource }
      ],
      limit: NEWS_ITEMS_PER_PAGE,
      offset: NEWS_ITEMS_PER_PAGE * (page - 1),
      order: [
        ['createdAt', 'DESC']
      ]
    }).then((newsItems) => {
      res.render('index', { newsItems: newsItems, page: page, title: 'news'});
    });
  }
});

module.exports = router;
{'fraction_non_alphanumeric': 0.17632850241545894, 'fraction_numerical': 0.004830917874396135, 'mean_word_length': 2.88056206088993, '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': '7633406', 'n_tokens_mistral': 589, 'n_tokens_neox': 571, 'n_words': 120}