<commit_before>/**
 * =================
 * MODULE - Views
 * =================
 * Manage the client views
 */

var config = require("./config");
var logger = require("./logger");


/*
 * VIEW Index
 */
function viewIndex(req, res) {
	logger.debug("<View> Viewing index (User "+req.user.username+").");
	res.render('index', {title: "Main", username: req.user.username});
}

/*
 * VIEW SignIn
 */
function viewSignin(req, res) {
	logger.debug("<View> Viewing signin.");
	res.render('signin', {title: "Sign-In", username: (req.user? req.user.username: '')});
}


/*
 * VIEW Login
 */
function viewLogin(req, res) {
	next = req.param("next", null);
	logger.info("<View> Viewing login page. Next is : " + next);
	res.render('login', {title: "Login", next: next, error: null, username: (req.user? req.user.username: '')});
}

/*
 * VIEW OpenID
 */
function viewOpenID(req, res) {
	next = req.param("next", null);
	logger.info("<View> Viewing OpenID login page. Next is : " + next);
	res.render('openid', {title: "OpenID Authentification", next: next, error: null, username: (req.user? req.user.username: '')});
}

/*
 * VIEW API
 */
function viewApi(req, res) {
	next = req.param("next", null);
	logger.info("<View> Viewing API");
	res.render('api', {title: "API", username: (req.user? req.user.username: '')});
}

function dateToString(date) {
	var s = "";
	s += date.getFullYear();
	s += "/";
	s += twoDigits(date.getMonth()+1);
	s += "/";
	s += twoDigits(date.getDate());
	s += " ";
	s += twoDigits(date.getHours());
	s += ":";
	s += twoDigits(date.getMinutes());
	s += ":";
	s += twoDigits(date.getSeconds());
	return s;
}

function twoDigits(nb) {
	var retour = nb < 10 ? "0" + nb : "" + nb;
	return retour;
}


function viewNotfound(req, res) {
	logger.warn("<View> View not found : " + req.url);
	res.render('404', {title: "Page not found", username: (req.user? req.user.username: '')});
}

function viewHelp(req, res) {
	logger.info("<View> Viewing help page.");
	res.render('help', {title: "Help", username: (req.user? req.user.username: '')});
}

/*
 * VIEW Gallery
 */
function viewGallery(req, res) {
	logger.info("<View> Viewing gallery.");
	res.render('gallery', {title: "Gallery", username: (req.user? req.user.username: '')});
}

/*
 * VIEW My Models Gallery
 */
function viewMyModels(req, res) {
	logger.info("<View> Viewing My Models.");
	res.render('mymodels', {title: "My Models", username: (req.user? req.user.username: '')});
}

/*
 * VIEW User Profile
 */
function viewProfile(req, res) {
	logger.info("<View> Viewing User Profile.");
	res.render('profile', {title: "Profile", username: (req.user? req.user.username: '')});
}

/*
 * VIEW Model
 */
function viewModel(req, res) {
	logger.info("<View> Viewing Model ("+req.url+")");
	res.render('model', {title: "Model", username: (req.user? req.user.username: '')});
}

exports.index = viewIndex;<commit_msg><Views> Added backend fix for issue #24<commit_after>/**
 * =================
 * MODULE - Views
 * =================
 * Manage the client views
 */

var config = require("./config");
var logger = require("./logger");


/*
 * VIEW Index
 */
function viewIndex(req, res) {
	logger.debug("<View> Viewing index (User "+req.user.username+").");
	res.render('index', {title: "Main", username: req.user.username, userId: req.user.userId});
}

/*
 * VIEW SignIn
 */
function viewSignin(req, res) {
	logger.debug("<View> Viewing signin.");
	res.render('signin', {title: "Sign-In", username: (req.user? req.user.username: ''), userId: (req.user? req.user.userId: '')});
}


/*
 * VIEW Login
 */
function viewLogin(req, res) {
	next = req.param("next", null);
	logger.info("<View> Viewing login page. Next is : " + next);
	res.render('login', {title: "Login", next: next, error: null, username: (req.user? req.user.username: ''), userId: (req.user? req.user.userId: '')});
}

/*
 * VIEW OpenID
 */
function viewOpenID(req, res) {
	next = req.param("next", null);
	logger.info("<View> Viewing OpenID login page. Next is : " + next);
	res.render('openid', {title: "OpenID Authentification", next: next, error: null, username: (req.user? req.user.username: ''), userId: (req.user? req.user.userId: '')});
}

/*
 * VIEW API
 */
function viewApi(req, res) {
	next = req.param("next", null);
	logger.info("<View> Viewing API");
	res.render('api', {title: "API", username: (req.user? req.user.username: ''), userId: (req.user? req.user.userId: '')});
}

function dateToString(date) {
	var s = "";
	s += date.getFullYear();
	s += "/";
	s += twoDigits(date.getMonth()+1);
	s += "/";
	s += twoDigits(date.getDate());
	s += " ";
	s += twoDigits(date.getHours());
	s += ":";
	s += twoDigits(date.getMinutes());
	s += ":";
	s += twoDigits(date.getSeconds());
	return s;
}

function twoDigits(nb) {
	var retour = nb < 10 ? "0" + nb : "" + nb;
	return retour;
}


function viewNotfound(req, res) {
	logger.warn("<View> View not found : " + req.url);
	res.render('404', {title: "Page not found", username: (req.user? req.user.username: ''), userId: (req.user? req.user.userId: '')});
}

function viewHelp(req, res) {
	logger.info("<View> Viewing help page.");
	res.render('help', {title: "Help", username: (req.user? req.user.username: ''), userId: (req.user? req.user.userId: '')});
}

/*
 * VIEW Gallery
 */
function viewGallery(req, res) {
	logger.info("<View> Viewing gallery.");
	res.render('gallery', {title: "Gallery", username: (req.user? req.user.username: ''), userId: (req.user? req.user.userId: '')});
}

/*
 * VIEW My Models Gallery
 */
function viewMyModels(req, res) {
	logger.info("<View> Viewing My Models.");
	res.render('mymodels', {title: "My Models", username: (req.user? req.user.username: ''), userId: (req.user? req.user.userId: '')});
}

/*
 * VIEW User Profile
 */
function viewProfile(req, res) {
	logger.info("<View> Viewing User Profile.");
	res.render('profile', {title: "Profile", username: (req.user? req.user.username: ''), userId: (req.user? req.user.userId: '')});
}

/*
 * VIEW Model
 */
function viewModel(req, res) {
	logger.info("<View> Viewing Model ("+req.url+")");
	res.render('model', {title: "Model", username: (req.user? req.user.username: ''), userId: (req.user? req.user.userId: '')});
}

exports.index = viewIndex;
{'fraction_non_alphanumeric': 0.23272668706716057, 'fraction_numerical': 0.0025769044934772106, 'mean_word_length': 4.395308427454387, 'pattern_counts': {'":': 4, '<': 28, '<?xml version=': 0, '>': 26, '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': '2380545', 'n_tokens_mistral': 2233, 'n_tokens_neox': 2255, 'n_words': 515}