<commit_before><?php
/**
 * Form class
 *
 * @package     Webenq
 * @subpackage  Forms
 * @author      <NAME> <<EMAIL>>
 */
class Webenq_Form_Questionnaire_Add extends Zend_Form
{
    public function init()
    {
        foreach (Webenq_Language::getLanguages() as $language) {
            $this->addElement($this->createElement('text', $language, array(
                'belongsTo' => 'title',
                'label' => t('title') . " ($language)",
                'filters' => array('StringTrim'),
                'validators' => array(
                    new Zend_Validate_NotEmpty(),
                    new Zend_Validate_Regex('/^[\w\d\s\?\.\+\-_,=\'"]*$/'),
                ),
            )));
        }

        $this->addElement($this->createElement('submit', 'submit', array(
            'label' => 'save',
        )));
    }

    public function isValid($values)
    {
        // at least one language is required
        $hasAtLeastOneLanguage = false;
        foreach ($values['title'] as $language) {
            if (!empty($language)) {
                $hasAtLeastOneLanguage = true;
                break;
            }
        }<commit_msg>fix: check of index bestaat voordat foreach gedaan wordt<commit_after><?php
/**
 * Form class
 *
 * @package     Webenq
 * @subpackage  Forms
 * @author      <NAME> <<EMAIL>>
 */
class Webenq_Form_Questionnaire_Add extends Zend_Form
{
    public function init()
    {
        foreach (Webenq_Language::getLanguages() as $language) {
            $this->addElement($this->createElement('text', $language, array(
                'belongsTo' => 'title',
                'label' => t('title') . " ($language)",
                'filters' => array('StringTrim'),
                'validators' => array(
                    new Zend_Validate_NotEmpty(),
                    new Zend_Validate_Regex('/^[\w\d\s\?\.\+\-_,=\'"]*$/'),
                ),
            )));
        }

        $this->addElement($this->createElement('submit', 'submit', array(
            'label' => 'save',
        )));
    }

    public function isValid($values)
    {
        // at least one language is required
        $hasAtLeastOneLanguage = false;
        if (isset($values['title'])) {
            foreach ($values['title'] as $language) {
                if (!empty($language)) {
                    $hasAtLeastOneLanguage = true;
                    break;
                }
            }
        }
{'fraction_non_alphanumeric': 0.15460526315789475, 'fraction_numerical': 0.0, 'mean_word_length': 1.6883977900552487, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 27, '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': '4654953', 'n_tokens_mistral': 697, 'n_tokens_neox': 666, 'n_words': 134}