<commit_before><?php
/*
 * lib/app_bootstrap.php - part of amtc-web, part of amtc
 * https://github.com/schnoddelbotz/amtc
 *
 * Try to load config, require libs, initialzie ORM and Slim
 */

define('AMTC_WEBROOT', dirname(__FILE__).'/..');
define('AMTC_CFGFILE', AMTC_WEBROOT.'/config/siteconfig.php');

if (file_exists(AMTC_CFGFILE))
  include AMTC_CFGFILE; // to let static ember help pages work even if unconfigured

date_default_timezone_set( defined('AMTC_TZ') ? AMTC_TZ : 'Europe/Berlin');

set_include_path(get_include_path().PATH_SEPARATOR.
  AMTC_WEBROOT.'/lib'.PATH_SEPARATOR.AMTC_WEBROOT.'/lib/db-model');
spl_autoload_extensions('.php');
spl_autoload_register();

require 'idiorm.php';
require 'paris.php';
require 'Slim/Slim.php';

// Initialize http://j4mie.github.io/idiormandparis/
if (defined("AMTC_PDOSTRING")) {
  ORM::configure(AMTC_PDOSTRING);
  ORM::configure('username', AMTC_DBUSER);
  ORM::configure('password', AMTC_DBPASS);
}

// Initialize http://www.slimframework.com/
\Slim\Slim::registerAutoloader();
$app = new \Slim\Slim();
$app->config('debug', false); // ... and enables custom $app->error() handler
$app->response()->header('Content-Type', 'application/json;charset=utf-8');
$app->notFound(function () {
  echo json_encode(Array('error'=>'Not found'));
});
$app->error(function (\Exception $e) {
  echo json_encode( array('exceptionMessage'=> substr($e->getMessage(),0,128).'...') );
});<commit_msg>cleanup .......<commit_after><?php
/*
 * lib/app_bootstrap.php - part of amtc-web, part of amtc
 * https://github.com/schnoddelbotz/amtc
 *
 * Try to load config, require libs, initialzie ORM and Slim
 */

define('AMTC_WEBROOT', dirname(__FILE__).'/..');
define('AMTC_CFGFILE', AMTC_WEBROOT.'/config/siteconfig.php');

if (file_exists(AMTC_CFGFILE))
  include AMTC_CFGFILE; // to let static ember help pages work even if unconfigured

date_default_timezone_set( defined('AMTC_TZ') ? AMTC_TZ : 'Europe/Berlin');

set_include_path(get_include_path().PATH_SEPARATOR.
  AMTC_WEBROOT.'/lib'.PATH_SEPARATOR.AMTC_WEBROOT.'/lib/db-model');
spl_autoload_extensions('.php');
spl_autoload_register();

require 'idiorm.php';
require 'paris.php';
require 'Slim/Slim.php';

// Initialize http://j4mie.github.io/idiormandparis/
if (defined("AMTC_PDOSTRING")) {
  ORM::configure(AMTC_PDOSTRING);
  ORM::configure('username', AMTC_DBUSER);
  ORM::configure('password', <PASSWORD>);
}

// Initialize http://www.slimframework.com/
\Slim\Slim::registerAutoloader();
$app = new \Slim\Slim();
$app->config('debug', false); // ... and enables custom $app->error() handler
$app->response()->header('Content-Type', 'application/json;charset=utf-8');
$app->notFound(function () {
  echo json_encode(Array('error'=>'Not found'));
});
$app->error(function (\Exception $e) {
  echo json_encode( array('exceptionMessage'=> substr($e->getMessage(),0,128).'...') );
});

function getSubmit($_app,$key) {
  $ret = null;
  $data = get_object_vars(json_decode($_app->request()->getBody()));
  if (isset($data[$key]))
    $ret = get_object_vars($data[$key]);
  return $ret;
}
{'fraction_non_alphanumeric': 0.191869918699187, 'fraction_numerical': 0.003902439024390244, 'mean_word_length': 5.672451193058568, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 24, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '3491970', 'n_tokens_mistral': 1125, 'n_tokens_neox': 1113, 'n_words': 185}