<commit_before><?php

/**
 * Basic Profile Area Controller
 *
 */
class ProfileController extends Controller
{
    private static $menu_icon = '<i class="fa fa-user"></i>';
    private static $menu_title = 'Profile';
    private static $url_segment = 'profile';
    private static $template_main = 'ProfileController';

    private static $url_handlers = [
        '' => 'index',
        '$ProfileController!/$Action/$ID/$OtherID' => 'handleController',
    ];

    private static $allowed_actions = [
        'index' => true,
        'handleController' => true,
    ];

    private static $requirements_css = [];
    private static $requirements_javascript = [];

    protected $member;
    protected $response_controller;
    protected $profile_classes;

    public function init()
    {
        parent::init();

        if (!$this->member) {
            $currentUser = Member::currentUser();
            if (!$currentUser) {
                return Security::permissionFailure(
                    $this,
                    _t('ProfileController.MUSTBELOGGEDIN', 'You must log in to view your profile.')
                );
            } else {
                $this->setMember($currentUser);
            }
        }

        Requirements::combine_files(get_class($this).'.css', $this->stat('requirements_css'));
        Requirements::combine_files(get_class($this).'.js', $this->stat('requirements_javascript'));

        $this->extend('init');
    }

    public static function canView()
    {
        return true;
    }

    public function getMember()
    {
        return $this->member;
    }

    public function setMember($member)
    {
        $this->member = $member;

        return $this;
    }

    public function Link($params = null)
    {
        $class = get_class($this);
        $action = ($class === get_class($this)) ? '' : $class;

        return self::join_links(
            $action,
            $params
        );
    }

    public static function join_links()
    {
        $class = get_called_class();
        $url_segment = '';

        if ($class !== 'ProfileController') {
            $url_segment = self::config()->get('url_segment', Config::UNINHERITED);
            $url_segment = $url_segment ? $url_segment : $class;
        }

        $args = array_merge([
            ProfileController::config()->get('url_segment', Config::UNINHERITED),
            $url_segment
        ], func_get_args());

        return parent::join_links(...$args);
    }

    public function Title($class = null)
    {
        $class = $class ? $class : get_class($this);

        $configTitle = Config::inst()->get($class, 'menu_title', Config::UNINHERITED);

        $fallback_title = $configTitle
            ? $configTitle
            : trim(preg_replace('/[A-Z]/', ' $0', $class));

        return _t(
            $class.'.TITLE',
            $fallback_title
        );
    }

    public function Icon($class = null)
    {
        $class = $class ? $class : get_class($this);
        return Config::inst()->get($class, 'menu_icon', Config::UNINHERITED);
    }

    /**<commit_msg>FIX: Relative Linking<commit_after><?php

/**
 * Basic Profile Area Controller
 *
 */
class ProfileController extends Controller
{
    private static $menu_icon = '<i class="fa fa-user"></i>';
    private static $menu_title = 'Profile';
    private static $url_segment = 'profile';
    private static $template_main = 'ProfileController';

    private static $url_handlers = [
        '' => 'index',
        '$ProfileController!/$Action/$ID/$OtherID' => 'handleController',
    ];

    private static $allowed_actions = [
        'index' => true,
        'handleController' => true,
    ];

    private static $requirements_css = [];
    private static $requirements_javascript = [];

    protected $member;
    protected $response_controller;
    protected $profile_classes;

    public function init()
    {
        parent::init();

        if (!$this->member) {
            $currentUser = Member::currentUser();
            if (!$currentUser) {
                return Security::permissionFailure(
                    $this,
                    _t('ProfileController.MUSTBELOGGEDIN', 'You must log in to view your profile.')
                );
            } else {
                $this->setMember($currentUser);
            }
        }

        Requirements::combine_files(get_class($this).'.css', $this->stat('requirements_css'));
        Requirements::combine_files(get_class($this).'.js', $this->stat('requirements_javascript'));

        $this->extend('init');
    }

    public static function canView()
    {
        return true;
    }

    public function getMember()
    {
        return $this->member;
    }

    public function setMember($member)
    {
        $this->member = $member;

        return $this;
    }

    public function Link($params = null)
    {
        $class = get_class($this);
        $action = ($class === get_class($this)) ? '' : $class;

        return self::join_links(
            $action,
            $params
        );
    }

    public static function join_links()
    {
        $class = get_called_class();
        $url_segment = '';

        if ($class !== 'ProfileController') {
            $url_segment = self::config()->get('url_segment', Config::UNINHERITED);
            $url_segment = $url_segment ? $url_segment : $class;
        }

        $args = array_merge([
            '/',
            ProfileController::config()->get('url_segment', Config::UNINHERITED),
            $url_segment
        ], func_get_args());

        return parent::join_links(...$args);
    }

    public function Title($class = null)
    {
        $class = $class ? $class : get_class($this);

        $configTitle = Config::inst()->get($class, 'menu_title', Config::UNINHERITED);

        $fallback_title = $configTitle
            ? $configTitle
            : trim(preg_replace('/[A-Z]/', ' $0', $class));

        return _t(
            $class.'.TITLE',
            $fallback_title
        );
    }

    public function Icon($class = null)
    {
        $class = $class ? $class : get_class($this);
        return Config::inst()->get($class, 'menu_icon', Config::UNINHERITED);
    }

    /**
{'fraction_non_alphanumeric': 0.14589030078816148, 'fraction_numerical': 0.00032169856844137045, 'mean_word_length': 2.145169448659585, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 37, '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': '1651694', 'n_tokens_mistral': 1782, 'n_tokens_neox': 1716, 'n_words': 346}