<commit_before><?php
/**
  * osCommerce Online Merchant
  *
  * @copyright Copyright (c) 2015 osCommerce; http://www.oscommerce.com
  * @license GPL; http://www.oscommerce.com/gpllicense.txt
  */

namespace OSC\OM;

use OSC\OM\DateTime;
use OSC\OM\HTML;
use OSC\OM\HTTP;

class OSCOM
{
    const BASE_DIR = OSCOM_BASE_DIR;

    protected static $version;

    public static function initialize()
    {
        DateTime::setTimeZone();
    }

    public static function getVersion()
    {
        if (!isset(static::$version)) {
            $file = static::BASE_DIR . 'version.php';

            $v = trim(file_get_contents($file));

            if (preg_match('/^(\d+\.)?(\d+\.)?(\d+)$/', $v)) {
                static::$version = $v;
            } else {
                trigger_error('Version number is not numeric. Please verify: ' . $file);
            }
        }

        return static::$version;
    }

    public static function link($page, $parameters = null, $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true)
    {
        global $request_type;

        $page = HTML::sanitize($page);

        if (!in_array($connection, ['NONSSL', 'SSL', 'AUTO'])) {
            $connection = 'NONSSL';
        }

        if (!is_bool($add_session_id)) {
            $add_session_id = true;
        }

        if (!is_bool($search_engine_safe)) {
            $search_engine_safe = true;
        }

        if ($connection == 'AUTO') {
            $connection = ($request_type == 'SSL') ? 'SSL' : 'NONSSL';
        }

        if (($connection == 'SSL') && (ENABLE_SSL !== true)) {
            $connection = 'NONSSL';
        }

        if ($connection == 'NONSSL') {
            $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
        } else {
            $link = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG;
        }

        $link .= $page;

        if (!empty($parameters)) {
            $link .= '?' . HTML::sanitize($parameters);<commit_msg>support admin links<commit_after><?php
/**
  * osCommerce Online Merchant
  *
  * @copyright Copyright (c) 2015 osCommerce; http://www.oscommerce.com
  * @license GPL; http://www.oscommerce.com/gpllicense.txt
  */

namespace OSC\OM;

use OSC\OM\DateTime;
use OSC\OM\HTML;
use OSC\OM\HTTP;

class OSCOM
{
    const BASE_DIR = OSCOM_BASE_DIR;

    protected static $version;

    public static function initialize()
    {
        DateTime::setTimeZone();
    }

    public static function getVersion()
    {
        if (!isset(static::$version)) {
            $file = static::BASE_DIR . 'version.php';

            $v = trim(file_get_contents($file));

            if (preg_match('/^(\d+\.)?(\d+\.)?(\d+)$/', $v)) {
                static::$version = $v;
            } else {
                trigger_error('Version number is not numeric. Please verify: ' . $file);
            }
        }

        return static::$version;
    }

    public static function link($page, $parameters = null, $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true)
    {
        global $request_type;

        $page = HTML::sanitize($page);

        if (!in_array($connection, ['NONSSL', 'SSL', 'AUTO'])) {
            $connection = 'NONSSL';
        }

        if (!is_bool($add_session_id)) {
            $add_session_id = true;
        }

        if (!is_bool($search_engine_safe)) {
            $search_engine_safe = true;
        }

        if ($connection == 'AUTO') {
            $connection = ($request_type == 'SSL') ? 'SSL' : 'NONSSL';
        }

        if (($connection == 'SSL') && (ENABLE_SSL !== true)) {
            $connection = 'NONSSL';
        }

        if (strncmp($page, 'admin/', 6) === 0) {
            $page = substr($page, 6);

            if ($connection == 'NONSSL') {
                $link = HTTP_SERVER . DIR_WS_ADMIN;
            } else {
                $link = HTTPS_SERVER . DIR_WS_HTTPS_ADMIN;
            }
        } else {
            if ($connection == 'NONSSL') {
                $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
            } else {
                $link = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG;
            }
        }

        $link .= $page;

        if (!empty($parameters)) {
            $link .= '?' . HTML::sanitize($parameters);
{'fraction_non_alphanumeric': 0.15509915014164305, 'fraction_numerical': 0.0025967894239848914, 'mean_word_length': 1.8921501706484642, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '7227797', 'n_tokens_mistral': 1359, 'n_tokens_neox': 1318, 'n_words': 266}