<commit_before><?php

require_once(__DIR__.'/vendor/autoload.php');
require_once(__DIR__.'/settings.inc.php');

use Symfony\Component\HttpFoundation\Session\Session;
use \RedBean_Facade as R;

// Scaffolding
error_reporting(E_ALL ^ E_NOTICE);
ini_set('session.use_trans_sid', 0);
ini_set('session.use_only_cookies', 1);
mb_internal_encoding('UTF-8');
setlocale(LC_ALL, 'fr_FR.UTF8');
$app = new Silex\Application();

// ORM
R::setup('mysql:host='.DB_HOST.';dbname='.DB_NAME, DB_USER, DB_PASS);
R::$toolbox->getRedBean()->setBeanHelper(new Patchwork\Helper\Bean());

// Controllers
$app['controllers_factory'] = function() use ($app) { return new Patchwork\Helper\ControllerCollection($app['route_factory']); };
$app->mount('/', new Patchwork\Controller\FrontController());
$app->mount('/admin/pizza', new Patchwork\Controller\AdminPizzaController());

// Session
$app['session'] = $app->share(function()
{
    $session = new Session();
    $session->start();
    return $session;
});

// Misc providers
$app->register(new Silex\Provider\UrlGeneratorServiceProvider());
$app->register(new Silex\Provider\ValidatorServiceProvider());

// Twig
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__.'/views'));
$app['twig']->addExtension(new Entea\Twig\Extension\AssetExtension($app, array('asset.directory' => 'assets')));
$app['twig']->addFunction('strpos', new Twig_Function_Function('strpos'));
$app['twig']->addFunction('fb_link', new Twig_Function_Function('Patchwork\Helper\Tools::fb_link'));
$app['twig']->addFunction('tw_link', new Twig_Function_Function('Patchwork\Helper\Tools::tw_link'));
$app['twig']->addFunction('gp_link', new Twig_Function_Function('Patchwork\Helper\Tools::gp_link'));
$app['twig']->addFunction('li_link', new Twig_Function_Function('Patchwork\Helper\Tools::li_link'));
$app['twig']->addFilter('vulgarize', new Twig_Filter_Function('Patchwork\Helper\Tools::vulgarize'));
$app['twig']->addFilter('var_dump', new Twig_Filter_Function('var_dump'));

// Translations
$app->register(new Silex\Provider\TranslationServiceProvider(), array('locale' => 'fr'));
$app['translator.domains'] = $translations;

// Swift Mailer
$app->register(new Silex\Provider\SwiftmailerServiceProvider());
$app['swiftmailer.transport'] = new Swift_MailTransport();

// Environment
if ( ! ($app['debug'] = DEBUG_MODE))
{
    R::freeze(true);

    // Error handler
    $app->error(function(\Exception $e, $code) use ($app)
    {
        $message = $e->getMessage();
        switch ($code)
        {<commit_msg>corrected asset path<commit_after><?php

require_once(__DIR__.'/vendor/autoload.php');
require_once(__DIR__.'/settings.inc.php');

use Symfony\Component\HttpFoundation\Session\Session;
use \RedBean_Facade as R;

// Scaffolding
error_reporting(E_ALL ^ E_NOTICE);
ini_set('session.use_trans_sid', 0);
ini_set('session.use_only_cookies', 1);
mb_internal_encoding('UTF-8');
setlocale(LC_ALL, 'fr_FR.UTF8');
$app = new Silex\Application();

// ORM
R::setup('mysql:host='.DB_HOST.';dbname='.DB_NAME, DB_USER, DB_PASS);
R::$toolbox->getRedBean()->setBeanHelper(new Patchwork\Helper\Bean());

// Controllers
$app['controllers_factory'] = function() use ($app) { return new Patchwork\Helper\ControllerCollection($app['route_factory']); };
$app->mount('/', new Patchwork\Controller\FrontController());
$app->mount('/admin/pizza', new Patchwork\Controller\AdminPizzaController());

// Session
$app['session'] = $app->share(function()
{
    $session = new Session();
    $session->start();
    return $session;
});

// Misc providers
$app->register(new Silex\Provider\UrlGeneratorServiceProvider());
$app->register(new Silex\Provider\ValidatorServiceProvider());

// Twig
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__.'/views'));
$app['twig']->addExtension(new Entea\Twig\Extension\AssetExtension($app, array('asset.directory' => str_replace('index.php', '', $_SERVER['SCRIPT_NAME']).'assets')));
$app['twig']->addFunction('strpos', new Twig_Function_Function('strpos'));
$app['twig']->addFunction('fb_link', new Twig_Function_Function('Patchwork\Helper\Tools::fb_link'));
$app['twig']->addFunction('tw_link', new Twig_Function_Function('Patchwork\Helper\Tools::tw_link'));
$app['twig']->addFunction('gp_link', new Twig_Function_Function('Patchwork\Helper\Tools::gp_link'));
$app['twig']->addFunction('li_link', new Twig_Function_Function('Patchwork\Helper\Tools::li_link'));
$app['twig']->addFilter('vulgarize', new Twig_Filter_Function('Patchwork\Helper\Tools::vulgarize'));
$app['twig']->addFilter('var_dump', new Twig_Filter_Function('var_dump'));

// Translations
$app->register(new Silex\Provider\TranslationServiceProvider(), array('locale' => 'fr'));
$app['translator.domains'] = $translations;

// Swift Mailer
$app->register(new Silex\Provider\SwiftmailerServiceProvider());
$app['swiftmailer.transport'] = new Swift_MailTransport();

// Environment
if ( ! ($app['debug'] = DEBUG_MODE))
{
    R::freeze(true);

    // Error handler
    $app->error(function(\Exception $e, $code) use ($app)
    {
        $message = $e->getMessage();
        switch ($code)
        {
{'fraction_non_alphanumeric': 0.197667638483965, 'fraction_numerical': 0.001554907677356657, 'mean_word_length': 7.103937007874015, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 51, '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': '2159590', 'n_tokens_mistral': 1726, 'n_tokens_neox': 1702, 'n_words': 237}