<commit_before><?php
const APP_PATH = __DIR__ . DIRECTORY_SEPARATOR;

if (getenv('CURRENT_ENV') == 'HEROKU') {
    require_once(APP_PATH . 'config.heroku.php');
    new empleadoEstatalConfig();
} else {
    require_once(APP_PATH . 'config.php');
}
require_once(APP_PATH . 'inc/newspaperParser.php');
require APP_PATH . 'vendor/autoload.php';

use Rudolf\OAuth2\Client\Provider\Reddit;
use League\HTMLToMarkdown\HtmlConverter;
use Monolog\Logger;
use Monolog\Handler\StreamHandler;


class empleadoEstatal
{
    private $subreddits = [
        'argentina'
    ];

    private $newspapers = [
        'lanacion.com.ar',
        'clarin.com',
        'ieco.clarin.com',
        'infobae.com',
        'cronista.com',
        'telam.com.ar',
        'buenosairesherald.com',
        'pagina12.com.ar',
        'minutouno.com',
        'autoblog.com.ar',
        'perfil.com',
    ];

    private $previousPosts = [];

    private $client;
    private $headers;
    public $log;

    private $debug = false;


    public function __construct()
    {
        $reddit = new Reddit([
            'clientId' => empleadoEstatalConfig::$CLIENT_ID,
            'clientSecret' => empleadoEstatalConfig::$SECRET_KEY,
            'redirectUri' => empleadoEstatalConfig::$REDIRECT_URI,
            'userAgent' => 'PHP:empleadoEstatalBot:0.0.1, (by /u/subtepass)',
            'scopes' => empleadoEstatalConfig::$SCOPES
        ]);

        $tokenExists = file_exists(APP_PATH . 'tmp/tokens.reddit');
        if ($tokenExists && filemtime(APP_PATH . 'tmp/tokens.reddit') + (60 * 50) < time()) {
            $tokenExists = false;
            unlink(APP_PATH . 'tmp/tokens.reddit');
        }

        if (!$tokenExists) {
            $accessToken = $reddit->getAccessToken('password', [
                'username' => empleadoEstatalConfig::$USERNAME,
                'password' => <PASSWORD>
            ]);

            $token = $accessToken->accessToken;
            file_put_contents(APP_PATH . 'tmp/tokens.reddit', $token);
        } else {
            $token = file_get_contents(APP_PATH . 'tmp/tokens.reddit');
        }

        $this->client = $reddit->getHttpClient();
        $this->headers = $reddit->getHeaders($token);

        if (file_exists(APP_PATH . 'tmp/previousPosts.json')) {
            $this->previousPosts = json_decode(file_get_contents(APP_PATH . 'tmp/previousPosts.json'), true);
            $this->log->addInfo('previousPosts.json loaded:', $this->previousPosts);
        } else {
            $this->log->addInfo('No previousPosts.json file found.');
        }

        $this->log = new Logger('chePibe');
        $this->log->pushHandler(new StreamHandler(APP_PATH . '/tmp/log.log', Logger::INFO));

    }
<commit_msg>Minor fix<commit_after><?php
const APP_PATH = __DIR__ . DIRECTORY_SEPARATOR;

if (getenv('CURRENT_ENV') == 'HEROKU') {
    require_once(APP_PATH . 'config.heroku.php');
    new empleadoEstatalConfig();
} else {
    require_once(APP_PATH . 'config.php');
}
require_once(APP_PATH . 'inc/newspaperParser.php');
require APP_PATH . 'vendor/autoload.php';

use Rudolf\OAuth2\Client\Provider\Reddit;
use League\HTMLToMarkdown\HtmlConverter;
use Monolog\Logger;
use Monolog\Handler\StreamHandler;


class empleadoEstatal
{
    private $subreddits = [
        'argentina'
    ];

    private $newspapers = [
        'lanacion.com.ar',
        'clarin.com',
        'ieco.clarin.com',
        'infobae.com',
        'cronista.com',
        'telam.com.ar',
        'buenosairesherald.com',
        'pagina12.com.ar',
        'minutouno.com',
        'autoblog.com.ar',
        'perfil.com',
    ];

    private $previousPosts = [];

    private $client;
    private $headers;
    public $log;

    private $debug = false;


    public function __construct()
    {
        $reddit = new Reddit([
            'clientId' => empleadoEstatalConfig::$CLIENT_ID,
            'clientSecret' => empleadoEstatalConfig::$SECRET_KEY,
            'redirectUri' => empleadoEstatalConfig::$REDIRECT_URI,
            'userAgent' => 'PHP:empleadoEstatalBot:0.0.1, (by /u/subtepass)',
            'scopes' => empleadoEstatalConfig::$SCOPES
        ]);

        $tokenExists = file_exists(APP_PATH . 'tmp/tokens.reddit');
        if ($tokenExists && filemtime(APP_PATH . 'tmp/tokens.reddit') + (60 * 50) < time()) {
            $tokenExists = false;
            unlink(APP_PATH . 'tmp/tokens.reddit');
        }

        if (!$tokenExists) {
            $accessToken = $reddit->getAccessToken('password', [
                'username' => empleadoEstatalConfig::$USERNAME,
                'password' => <PASSWORD>
            ]);

            $token = $accessToken->accessToken;
            file_put_contents(APP_PATH . 'tmp/tokens.reddit', $token);
        } else {
            $token = file_get_contents(APP_PATH . 'tmp/tokens.reddit');
        }

        $this->client = $reddit->getHttpClient();
        $this->headers = $reddit->getHeaders($token);

        $this->log = new Logger('chePibe');
        $this->log->pushHandler(new StreamHandler(APP_PATH . '/tmp/log.log', Logger::INFO));

        if (file_exists(APP_PATH . 'tmp/previousPosts.json')) {
            $this->previousPosts = json_decode(file_get_contents(APP_PATH . 'tmp/previousPosts.json'), true);
            $this->log->addInfo('previousPosts.json loaded:', $this->previousPosts);
        } else {
            $this->log->addInfo('No previousPosts.json file found.');
        }

    }

{'fraction_non_alphanumeric': 0.15003668378576668, 'fraction_numerical': 0.003668378576669112, 'mean_word_length': 2.4644218551461243, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 49, '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': '2777229', 'n_tokens_mistral': 1787, 'n_tokens_neox': 1758, 'n_words': 265}