<commit_before><?php

namespace cms\widgets;

use Yii;

class LanguageSwitcherWidget extends \yii\base\Widget
{
    public $message = null;

    public function run()
    {
        $langData = Yii::$app->links->getActiveLanguages();
        
        $html = '<ul>';

        foreach ($langData as $lang) {
            $html .= '<li style="display:inline;margin-right:5px"><a href="'.$lang['lang'] . '/' .$lang['url'].'">'.$lang['lang'].'</a></li>';
        }

        $html .= '</ul>';

        return $html;
    }
}<commit_msg>fixed langauge switcher widget when language could not be found.<commit_after><?php

namespace cms\widgets;

use Yii;

class LanguageSwitcherWidget extends \yii\base\Widget
{
    public $message = null;

    public function run()
    {
        $langData = Yii::$app->links->getActiveLanguages();
        
        $html = '<ul id="languageSwitcher">';

        foreach ($langData as $lang) {
            if (!$lang['link']) {
                $html .= '<li><a href="'.$lang['lang']['short_code'] .'">'.$lang['lang']['short_code'].'</a></li>';
            } else {
                $html .= '<li><a href="'.$lang['lang']['short_code'] . '/' .$lang['link']['url'].'">'.$lang['lang']['short_code'].'</a></li>';
            }
        }

        $html .= '</ul>';

        return $html;
    }
}
{'fraction_non_alphanumeric': 0.2176560121765601, 'fraction_numerical': 0.00076103500761035, 'mean_word_length': 2.329113924050633, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 23, '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': '7240944', 'n_tokens_mistral': 417, 'n_tokens_neox': 416, 'n_words': 80}