<commit_before><?php

/**
 * User Control Panel.
 *
 *
 *
 * This Source Code Form is subject to the terms of the Mozilla Public License,
 * v. 2.0. If a copy of the MPL was not distributed with this file, You can
 * obtain one at http://mozilla.org/MPL/2.0/.
 *
 * @category  phpMyFAQ
 * @author    <NAME> <<EMAIL>>
 * @copyright 2012-2019 phpMyFAQ Team
 * @license   http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
 * @link      https://www.phpmyfaq.de
 * @since     2012-01-12
 */

use phpMyFAQ\User\CurrentUser;
use phpMyFAQ\Services\Gravatar;

if (!defined('IS_VALID_PHPMYFAQ')) {
    $protocol = 'http';
    if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') {
        $protocol = 'https';
    }
    header('Location: '.$protocol.'://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME']));
    exit();
}

if ($user instanceof CurrentUser) {
    try {
        $faqSession->userTracking('user_control_panel', $user->getUserData('display_name'));
    } catch (Exception $e) {
        // @todo handle the exception
    }

    if ($faqConfig->get('main.enableGravatarSupport')) {
        $gravatar = new Gravatar($faqConfig);
        $gravatarImg = sprintf(
            '<a target="_blank" href="http://www.gravatar.com">%s</a>',
            $gravatar->getImage($user->getUserData('email'), ['class' => 'img-circle', 'size' => 125])
        );
    } else {
        $gravatarImg = '';
    }

    $template->parse(
        'writeContent',
        array(
            'headerUserControlPanel' => $PMF_LANG['headerUserControlPanel'],
            'ucpGravatarImage' => $gravatarImg,
            'userid' => $user->getUserId(),
            'csrf' => $user->getCsrfTokenFromSession(),
            'msgRealName' => $PMF_LANG['ad_user_name'],
            'realname' => $user->getUserData('display_name'),
            'msgEmail' => $PMF_LANG['msgNewContentMail'],
            'email' => $user->getUserData('email'),
            'msgPassword' => $PMF_LANG['ad_auth_<PASSWORD>'],
            'msgConfirm' => $PMF_LANG['ad_user_confirm'],
            'msgSave' => $PMF_LANG['msgSave'],
            'msgCancel' => $PMF_LANG['msgCancel'],
        )
    );

    $template->parseBlock(
        'index',
        'breadcrumb',
        [
            'breadcrumbHeadline' => $PMF_LANG['headerUserControlPanel']
        ]
    );

} else {
    // Redirect to login
    header('Location: '.$faqConfig->getDefaultUrl());
    exit();
}
<commit_msg>Fixed fatal error in UCP<commit_after><?php

/**
 * User Control Panel.
 *
 *
 *
 * This Source Code Form is subject to the terms of the Mozilla Public License,
 * v. 2.0. If a copy of the MPL was not distributed with this file, You can
 * obtain one at http://mozilla.org/MPL/2.0/.
 *
 * @category  phpMyFAQ
 * @author    <NAME> <<EMAIL>>
 * @copyright 2012-2019 phpMyFAQ Team
 * @license   http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
 * @link      https://www.phpmyfaq.de
 * @since     2012-01-12
 */

use phpMyFAQ\User\CurrentUser;
use phpMyFAQ\Services\Gravatar;

if (!defined('IS_VALID_PHPMYFAQ')) {
    $protocol = 'http';
    if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') {
        $protocol = 'https';
    }
    header('Location: '.$protocol.'://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME']));
    exit();
}

if ($user instanceof CurrentUser) {
    try {
        $faqSession->userTracking('user_control_panel', $user->getUserId());
    } catch (Exception $e) {
        // @todo handle the exception
    }

    if ($faqConfig->get('main.enableGravatarSupport')) {
        $gravatar = new Gravatar($faqConfig);
        $gravatarImg = sprintf(
            '<a target="_blank" href="http://www.gravatar.com">%s</a>',
            $gravatar->getImage($user->getUserData('email'), ['class' => 'img-circle', 'size' => 125])
        );
    } else {
        $gravatarImg = '';
    }

    $template->parse(
        'writeContent',
        array(
            'headerUserControlPanel' => $PMF_LANG['headerUserControlPanel'],
            'ucpGravatarImage' => $gravatarImg,
            'userid' => $user->getUserId(),
            'csrf' => $user->getCsrfTokenFromSession(),
            'msgRealName' => $PMF_LANG['ad_user_name'],
            'realname' => $user->getUserData('display_name'),
            'msgEmail' => $PMF_LANG['msgNewContentMail'],
            'email' => $user->getUserData('email'),
            'msgPassword' => $<PASSWORD>['<PASSWORD>'],
            'msgConfirm' => $PMF_LANG['ad_user_confirm'],
            'msgSave' => $PMF_LANG['msgSave'],
            'msgCancel' => $PMF_LANG['msgCancel'],
        )
    );

    $template->parseBlock(
        'index',
        'breadcrumb',
        [
            'breadcrumbHeadline' => $PMF_LANG['headerUserControlPanel']
        ]
    );

} else {
    // Redirect to login
    header('Location: '.$faqConfig->getDefaultUrl());
    exit();
}

{'fraction_non_alphanumeric': 0.1760520430981907, 'fraction_numerical': 0.010977841024598495, 'mean_word_length': 2.6363636363636362, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 70, 'https://': 2, 'lorem ipsum': 0, 'www.': 6, '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': '1950958', 'n_tokens_mistral': 1645, 'n_tokens_neox': 1586, 'n_words': 294}