<commit_before><?php

// First, do some low level checks, like whether autoload is present, the cache
// folder is writable, if the minimum PHP version is present, etc.
require_once __DIR__.'/classes/lib.php';
require_once __DIR__.'/classes/lowlevelchecks.php';

$checker = new LowlevelChecks();
$checker->doChecks();

// Let's get on with the rest..
require_once __DIR__.'/../vendor/autoload.php';
require_once __DIR__.'/classes/util.php';

// Start the timer:
$starttime=getMicrotime();

$config = getConfig();

// Finally, check if the app/database folder is writable, if it needs to be.
$checker->doDatabaseCheck($config);

$dboptions = getDBOptions($config);

$app = new Bolt\Application();

$app['debug'] = (!empty($config['general']['debug'])) ? $config['general']['debug'] : false;
$app['debugbar'] = false;
$app['config'] = $config;

$app->register(new Silex\Provider\SessionServiceProvider(), array(
    'session.storage.options' => array(
        'name' => 'bolt_session',
        'cookie_lifetime' => $config['general']['cookies_lifetime'],
        'cookie_domain' => $config['general']['cookies_domain']
    )
));

$app->register(new Silex\Provider\TwigServiceProvider(), array(
    'twig.path' => $config['twigpath'],
    'twig.options' => array(
        'debug'=>true,
        'cache' => __DIR__.'/cache/',
        'strict_variables' => $config['general']['strict_variables'],
        'autoescape' => true )
));
$app->register(new Silex\Provider\DoctrineServiceProvider(), array(
    'db.options' => $dboptions
));
$app->register(new Silex\Provider\HttpCacheServiceProvider(), array(
    'http_cache.cache_dir' => __DIR__.'/cache/',
));

$app->register(new Silex\Provider\SwiftmailerServiceProvider());
$app->register(new Silex\Provider\UrlGeneratorServiceProvider());
$app->register(new Silex\Provider\FormServiceProvider());
$app->register(new Silex\Provider\ValidatorServiceProvider());
$app->register(new Silex\Provider\TranslationServiceProvider(), array(
    'translator.messages' => array(),
));

// Loading stub functions for when intl / IntlDateFormatter isn't available.
if (!function_exists('intl_get_error_code')) {
    require_once __DIR__.'/../vendor/symfony/Locale/Symfony/Component/Locale/Resources/stubs/functions.php';
    require_once __DIR__.'/../vendor/symfony/Locale/Symfony/Component/Locale/Resources/stubs/IntlDateFormatter.php';
}

$app->register(new Bolt\LogServiceProvider(), array());
$app->register(new Bolt\StorageServiceProvider(), array());
$app->register(new Bolt\UsersServiceProvider(), array());
$app->register(new Bolt\CacheServiceProvider(), array());
$app->register(new Bolt\ExtensionServiceProvider(), array());

$app['paths'] = getPaths($config);
$app['twig']->addGlobal('paths', $app['paths']);

$app['end'] = getWhichEnd();
$app['twig']->addGlobal('frontend', false);
$app['twig']->addGlobal('backend', false);
$app['twig']->addGlobal('async', false);
$app['twig']->addGlobal($app['end'], true);

$app['editlink'] = "";

// Add the Bolt Twig functions, filters and tags.<commit_msg>Re-Add a twig var that was removed when merging previous changes.<commit_after><?php

// First, do some low level checks, like whether autoload is present, the cache
// folder is writable, if the minimum PHP version is present, etc.
require_once __DIR__.'/classes/lib.php';
require_once __DIR__.'/classes/lowlevelchecks.php';

$checker = new LowlevelChecks();
$checker->doChecks();

// Let's get on with the rest..
require_once __DIR__.'/../vendor/autoload.php';
require_once __DIR__.'/classes/util.php';

// Start the timer:
$starttime=getMicrotime();

$config = getConfig();

// Finally, check if the app/database folder is writable, if it needs to be.
$checker->doDatabaseCheck($config);

$dboptions = getDBOptions($config);

$app = new Bolt\Application();

$app['debug'] = (!empty($config['general']['debug'])) ? $config['general']['debug'] : false;
$app['debugbar'] = false;
$app['config'] = $config;

$app->register(new Silex\Provider\SessionServiceProvider(), array(
    'session.storage.options' => array(
        'name' => 'bolt_session',
        'cookie_lifetime' => $config['general']['cookies_lifetime'],
        'cookie_domain' => $config['general']['cookies_domain']
    )
));

$app->register(new Silex\Provider\TwigServiceProvider(), array(
    'twig.path' => $config['twigpath'],
    'twig.options' => array(
        'debug'=>true,
        'cache' => __DIR__.'/cache/',
        'strict_variables' => $config['general']['strict_variables'],
        'autoescape' => true )
));
$app->register(new Silex\Provider\DoctrineServiceProvider(), array(
    'db.options' => $dboptions
));
$app->register(new Silex\Provider\HttpCacheServiceProvider(), array(
    'http_cache.cache_dir' => __DIR__.'/cache/',
));

$app->register(new Silex\Provider\SwiftmailerServiceProvider());
$app->register(new Silex\Provider\UrlGeneratorServiceProvider());
$app->register(new Silex\Provider\FormServiceProvider());
$app->register(new Silex\Provider\ValidatorServiceProvider());
$app->register(new Silex\Provider\TranslationServiceProvider(), array(
    'translator.messages' => array(),
));

// Loading stub functions for when intl / IntlDateFormatter isn't available.
if (!function_exists('intl_get_error_code')) {
    require_once __DIR__.'/../vendor/symfony/Locale/Symfony/Component/Locale/Resources/stubs/functions.php';
    require_once __DIR__.'/../vendor/symfony/Locale/Symfony/Component/Locale/Resources/stubs/IntlDateFormatter.php';
}

$app->register(new Bolt\LogServiceProvider(), array());
$app->register(new Bolt\StorageServiceProvider(), array());
$app->register(new Bolt\UsersServiceProvider(), array());
$app->register(new Bolt\CacheServiceProvider(), array());
$app->register(new Bolt\ExtensionServiceProvider(), array());

$app['paths'] = getPaths($config);
$app['twig']->addGlobal('paths', $app['paths']);

$app['end'] = getWhichEnd();
$app['twig']->addGlobal('frontend', false);
$app['twig']->addGlobal('backend', false);
$app['twig']->addGlobal('async', false);
$app['twig']->addGlobal($app['end'], true);
$app['twig']->addGlobal('user', $app['users']->getCurrentUser());

$app['editlink'] = "";

// Add the Bolt Twig functions, filters and tags.
{'fraction_non_alphanumeric': 0.1920593931568754, 'fraction_numerical': 0.0, 'mean_word_length': 5.685005393743258, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 73, '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': '2923225', 'n_tokens_mistral': 1960, 'n_tokens_neox': 1953, 'n_words': 365}