<commit_before>var admin = require('../admin'),
	caps = require('./caps'),
	config = require('../config'),
	common = require('../common'),
	db = require('../db'),
	lang = require('../lang'),
	msgcheck = require('./msgcheck'),
	okyaku = require('./okyaku'),
	recaptcha = require('recaptcha'),
	winston = require('winston');

var SMTP = require('nodemailer').createTransport('SMTP', config.SMTP);

const ERRORS = {
	'invalid-site-private-key': "Sorry, the server isn't set up with reCAPTCHA properly.",
	'invalid-request-cookie': "Something went wrong with our reCAPTCHA token. Please try again.",
	'incorrect-captcha-sol': "Incorrect.",
	'captcha-timeout': "Sorry, you took too long. Please try again."
};

var safe = common.safe;

function report(reporter_ident, op, num, cb) {

	var board = caps.can_access_thread(reporter_ident, op);
	if (!board)
		return cb("Post does not exist.");

	var reporter = admin.genMnemonic(reporter_ident.ip) || '???';

	var reader = new db.Reader({auth: 'moderator'});
	var kind = op == num ? 'thread' : 'post';
	reader.get_post(kind, num, {}, function (err, post) {
		if (err || !post) {
			if (err)
				console.error(err);
			send_report(reporter, board, op, num, '', [], cb);
			return;<commit_msg>No server crash on reports<commit_after>var admin = require('../admin'),
	caps = require('./caps'),
	config = require('../config'),
	common = require('../common'),
	db = require('../db'),
	lang = require('../lang'),
	msgcheck = require('./msgcheck'),
	okyaku = require('./okyaku'),
	recaptcha = require('recaptcha'),
	winston = require('winston');

var SMTP = require('nodemailer').createTransport('SMTP', config.SMTP);

const ERRORS = {
	'invalid-site-private-key': "Sorry, the server isn't set up with reCAPTCHA properly.",
	'invalid-request-cookie': "Something went wrong with our reCAPTCHA token. Please try again.",
	'incorrect-captcha-sol': "Incorrect.",
	'captcha-timeout': "Sorry, you took too long. Please try again."
};

var safe = common.safe;

function report(reporter_ident, op, num, cb) {

	var board = caps.can_access_thread(reporter_ident, op);
	if (!board)
		return cb("Post does not exist.");

	var reporter = admin.genMnemonic(reporter_ident.ip) || '???';

	var reader = new db.Reader({auth: 'moderator'});
	var kind = op == num ? 'thread' : 'post';
	reader.get_post(kind, num, function (err, post) {
		if (err || !post) {
			if (err)
				console.error(err);
			send_report(reporter, board, op, num, '', [], cb);
			return;
{'fraction_non_alphanumeric': 0.18868686868686868, 'fraction_numerical': 0.0, 'mean_word_length': 4.406113537117904, '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': '4286164', 'n_tokens_mistral': 870, 'n_tokens_neox': 820, 'n_words': 221}