<commit_before><?php

/**
 * Allows a user to add a field that can be used to upload a file.
 *
 * @package userforms
 */
class EditableFileField extends EditableFormField
{

    private static $singular_name = 'File Upload Field';

    private static $plural_names = 'File Fields';

    private static $db = array(
        'MaxFileSizeMB' => 'Float',
    );

    private static $has_one = array(
        'Folder' => 'Folder' // From CustomFields
    );

    /**
     * Further limit uploadable file extensions in addition to the restrictions
     * imposed by the File.allowed_extensions global configuration.
     * @config
     */
    private static $allowed_extensions_blacklist = array(
        'htm', 'html', 'xhtml', 'swf', 'xml'
    );

    /**
     * @return FieldList
     */
    public function getCMSFields()
    {
        $fields = parent::getCMSFields();

        $fields->addFieldToTab(
            'Root.Main',
            TreeDropdownField::create(
                'FolderID',
                _t('EditableUploadField.SELECTUPLOADFOLDER', 'Select upload folder'),
                'Folder'
            )
        );

        $fields->addFieldToTab("Root.Main", new LiteralField("FileUploadWarning",
            "<p class=\"message notice\">" . _t("UserDefinedForm.FileUploadWarning",
                "Files uploaded through this field could be publicly accessible if the exact URL is known")
            . "</p>"), "Type");

        $fields->addFieldToTab(
            'Root.Main',
            NumericField::create('MaxFileSizeMB')
                ->setTitle('Max File Size MB')
                ->setDescription("Note: Maximum php allowed size is {$this->getPHPMaxFileSize()} MB")
        );

        return $fields;
    }

    /**
     * @return ValidationResult
     */
    public function validate()
    {
        $result = parent::validate();

        $max = static::get_php_max_file_size();
        if ($this->MaxFileSizeMB * 1024 > $max) {
            $result->error("Your max file size limit can't be larger than the server's limit of {$this->getPHPMaxFileSizeMB()}.");
        }

        return $result;
    }

    public function getFormField()
    {<commit_msg>BUGFIX incorrect method name<commit_after><?php

/**
 * Allows a user to add a field that can be used to upload a file.
 *
 * @package userforms
 */
class EditableFileField extends EditableFormField
{

    private static $singular_name = 'File Upload Field';

    private static $plural_names = 'File Fields';

    private static $db = array(
        'MaxFileSizeMB' => 'Float',
    );

    private static $has_one = array(
        'Folder' => 'Folder' // From CustomFields
    );

    /**
     * Further limit uploadable file extensions in addition to the restrictions
     * imposed by the File.allowed_extensions global configuration.
     * @config
     */
    private static $allowed_extensions_blacklist = array(
        'htm', 'html', 'xhtml', 'swf', 'xml'
    );

    /**
     * @return FieldList
     */
    public function getCMSFields()
    {
        $fields = parent::getCMSFields();

        $fields->addFieldToTab(
            'Root.Main',
            TreeDropdownField::create(
                'FolderID',
                _t('EditableUploadField.SELECTUPLOADFOLDER', 'Select upload folder'),
                'Folder'
            )
        );

        $fields->addFieldToTab("Root.Main", new LiteralField("FileUploadWarning",
            "<p class=\"message notice\">" . _t("UserDefinedForm.FileUploadWarning",
                "Files uploaded through this field could be publicly accessible if the exact URL is known")
            . "</p>"), "Type");

        $fields->addFieldToTab(
            'Root.Main',
            NumericField::create('MaxFileSizeMB')
                ->setTitle('Max File Size MB')
                ->setDescription("Note: Maximum php allowed size is {$this->getPHPMaxFileSizeMB()} MB")
        );

        return $fields;
    }

    /**
     * @return ValidationResult
     */
    public function validate()
    {
        $result = parent::validate();

        $max = static::get_php_max_file_size();
        if ($this->MaxFileSizeMB * 1024 > $max) {
            $result->error("Your max file size limit can't be larger than the server's limit of {$this->getPHPMaxFileSizeMB()}.");
        }

        return $result;
    }

    public function getFormField()
    {
{'fraction_non_alphanumeric': 0.12081148848871666, 'fraction_numerical': 0.0018235696375655346, 'mean_word_length': 2.188953488372093, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '2885420', 'n_tokens_mistral': 1238, 'n_tokens_neox': 1184, 'n_words': 327}