<commit_before><?php

use SilverStripe\Filesystem\Storage\AssetNameGenerator;
use SilverStripe\Forms\AssetGalleryField;
use SilverStripe\Forms\DropzoneUploadField;

/**
 * AssetAdmin is the 'file store' section of the CMS.
 * It provides an interface for manipulating the File and Folder objects in the system.
 *
 * @package cms
 * @subpackage assets
 */
class AssetAdmin extends LeftAndMain implements PermissionProvider
{
    private static $url_segment = 'assets';

    private static $url_rule = '/$Action/$ID';

    private static $menu_title = 'Files';

    private static $tree_class = 'Folder';

    /**
     * Amount of results showing on a single page.
     *
     * @config
     * @var int
     */
    private static $page_length = 15;

    /**
     * @config
     * @see Upload->allowedMaxFileSize
     * @var int
     */
    private static $allowed_max_file_size;

    private static $allowed_actions = array(
        'addfolder',
        'delete',
        'AddForm',
        'SearchForm',
    );

    /**
     * Return fake-ID "root" if no ID is found (needed to upload files into the root-folder)
     */
    public function currentPageID()
    {
        if (is_numeric($this->getRequest()->requestVar('ID'))) {
            return $this->getRequest()->requestVar('ID');
        } elseif (is_numeric($this->urlParams['ID'])) {
            return $this->urlParams['ID'];
        } elseif (Session::get("{$this->class}.currentPage")) {
            return Session::get("{$this->class}.currentPage");
        } else {
            return 0;
        }
    }

    /**
     * Gets the ID of the folder being requested.
     *
     * @return int
     */
    public function getCurrentFolderID()
    {
        $currentFolderID = 0;

        if ($this->urlParams['Action'] == 'show' && is_numeric($this->urlParams['ID'])) {
            $currentFolderID = $this->urlParams['ID'];
        }

        return $currentFolderID;
    }

    /**
     * Set up the controller
     */
    public function init()
    {
        parent::init();

        Requirements::javascript(FRAMEWORK_DIR . "/admin/javascript/dist/bundle-react.js");
        Requirements::javascript(ASSET_ADMIN_DIR . "/javascript/AssetAdmin.js");
        Requirements::add_i18n_javascript(ASSET_ADMIN_DIR . '/javascript/lang', false, true);
        Requirements::css(FRAMEWORK_ADMIN_DIR . "/thirdparty/bootstrap/bootstrap.css");
        Requirements::css(ASSET_ADMIN_DIR . "/javascript/dist/main.css");

        CMSBatchActionHandler::register('delete', 'AssetAdmin_DeleteBatchAction', 'Folder');
    }

    /**
     * Returns the files and subfolders contained in the currently selected folder,
     * defaulting to the root node. Doubles as search results, if any search parameters
     * are set through {@link SearchForm()}.
     *
     * @return SS_List
     */
    public function getList()
    {
        $folder = $this->currentPage();
        $context = $this->getSearchContext();
        // Overwrite name filter to search both Name and Title attributes
        $context->removeFilterByName('Name');<commit_msg>Remove bootstrap.css include, in LeftAndMain now<commit_after><?php

use SilverStripe\Filesystem\Storage\AssetNameGenerator;
use SilverStripe\Forms\AssetGalleryField;
use SilverStripe\Forms\DropzoneUploadField;

/**
 * AssetAdmin is the 'file store' section of the CMS.
 * It provides an interface for manipulating the File and Folder objects in the system.
 *
 * @package cms
 * @subpackage assets
 */
class AssetAdmin extends LeftAndMain implements PermissionProvider
{
    private static $url_segment = 'assets';

    private static $url_rule = '/$Action/$ID';

    private static $menu_title = 'Files';

    private static $tree_class = 'Folder';

    /**
     * Amount of results showing on a single page.
     *
     * @config
     * @var int
     */
    private static $page_length = 15;

    /**
     * @config
     * @see Upload->allowedMaxFileSize
     * @var int
     */
    private static $allowed_max_file_size;

    private static $allowed_actions = array(
        'addfolder',
        'delete',
        'AddForm',
        'SearchForm',
    );

    /**
     * Return fake-ID "root" if no ID is found (needed to upload files into the root-folder)
     */
    public function currentPageID()
    {
        if (is_numeric($this->getRequest()->requestVar('ID'))) {
            return $this->getRequest()->requestVar('ID');
        } elseif (is_numeric($this->urlParams['ID'])) {
            return $this->urlParams['ID'];
        } elseif (Session::get("{$this->class}.currentPage")) {
            return Session::get("{$this->class}.currentPage");
        } else {
            return 0;
        }
    }

    /**
     * Gets the ID of the folder being requested.
     *
     * @return int
     */
    public function getCurrentFolderID()
    {
        $currentFolderID = 0;

        if ($this->urlParams['Action'] == 'show' && is_numeric($this->urlParams['ID'])) {
            $currentFolderID = $this->urlParams['ID'];
        }

        return $currentFolderID;
    }

    /**
     * Set up the controller
     */
    public function init()
    {
        parent::init();

        Requirements::javascript(FRAMEWORK_DIR . "/admin/javascript/dist/bundle-react.js");
        Requirements::javascript(ASSET_ADMIN_DIR . "/javascript/AssetAdmin.js");
        Requirements::add_i18n_javascript(ASSET_ADMIN_DIR . '/javascript/lang', false, true);
        Requirements::css(ASSET_ADMIN_DIR . "/javascript/dist/main.css");

        CMSBatchActionHandler::register('delete', 'AssetAdmin_DeleteBatchAction', 'Folder');
    }

    /**
     * Returns the files and subfolders contained in the currently selected folder,
     * defaulting to the root node. Doubles as search results, if any search parameters
     * are set through {@link SearchForm()}.
     *
     * @return SS_List
     */
    public function getList()
    {
        $folder = $this->currentPage();
        $context = $this->getSearchContext();
        // Overwrite name filter to search both Name and Title attributes
        $context->removeFilterByName('Name');
{'fraction_non_alphanumeric': 0.12726975298544085, 'fraction_numerical': 0.001963029609029936, 'mean_word_length': 2.615612063867534, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 33, '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': '4987789', 'n_tokens_mistral': 1758, 'n_tokens_neox': 1707, 'n_words': 432}