<commit_before><?php
/*"******************************************************************************************************
*   (c) 2004-2006 by MulchProductions, www.mulchprod.de                                                 *
*   (c) 2007-2009 by Kajona, www.kajona.de                                                              *
*       Published under the GNU LGPL v2.1, see /system/licence_lgpl.txt                                 *
*-------------------------------------------------------------------------------------------------------*
*	$Id$                             *
********************************************************************************************************/

/**
 * Downloads Portal. Generates a list of available downloads
 *
 * @package modul_downloads
 */
class class_modul_downloads_portal extends class_portal implements interface_portal {
	/**
	 * Constructor
	 *
	 * @param mixed $arrElementData
	 */
	public function __construct($arrElementData) {
        $arrModul = array();
		$arrModul["name"] 				= "modul_downloads";
		$arrModul["author"] 			= "<EMAIL>";
		$arrModul["table2"] 			= _dbprefix_."downloads_file";
		$arrModul["table"] 			    = _dbprefix_."downloads_archive";
		$arrModul["table3"] 			= _dbprefix_."downloads_logs";
		$arrModul["moduleId"] 			= _downloads_modul_id_;
		$arrModul["modul"] 			    = "downloads";

		parent::__construct($arrModul, $arrElementData);
	}

	/**
	 * Action-block, controling the behaviour of the class
	 *
	 * @return string
	 */
	public function action() {
	    $strReturn = "";
		$strAction = "";

		if($this->getParam("action") != "")
		    $strAction = $this->getParam("action");

        if($strAction == "detailDownload")
            $strReturn = $this->actionDetailDownload();
        else
            $strReturn = $this->actionList();

		return $strReturn;

	}

//---Aktionsfunktionen-----------------------------------------------------------------------------------

	/**
	 * Creates a list of files & folders
	 *
	 * @return string
	 */
	public function actionList() {
		$strReturn = "";

		//systemid passed?
		if( !validateSystemid($this->getSystemid() ) || $this->getAction() != "openDlFolder" || ! $this->checkSystemidBelongsToCurrentTree() ) {
            if(isset($this->arrElementData["download_id"]))
                $this->setSystemid($this->arrElementData["download_id"]);
		}


        //Load all files
	    $objArraySectionIterator = new class_array_section_iterator($this->getNumberOfEntriesOnLevel());
	    $objArraySectionIterator->setIntElementsPerPage($this->arrElementData["download_amount"]);
	    $objArraySectionIterator->setPageNumber((int)($this->getParam("pv") != "" ? $this->getParam("pv") : 1));
	    $objArraySectionIterator->setArraySection($this->getArrFiles($objArraySectionIterator->calculateStartPos(), $objArraySectionIterator->calculateEndPos()));

	    $arrObjects = $objArraySectionIterator->getArrayExtended();

		$arrObjects = $this->objToolkit->pager($this->arrElementData["download_amount"], ($this->getParam("pv") != "" ? $this->getParam("pv") : 1), $this->getText("weiter"), $this->getText("zurueck"), "", ($this->getParam("page") != "" ? $this->getParam("page") : ""), $arrObjects);


<commit_msg>BUG: existance of amount-param is checked<commit_after><?php
/*"******************************************************************************************************
*   (c) 2004-2006 by MulchProductions, www.mulchprod.de                                                 *
*   (c) 2007-2009 by Kajona, www.kajona.de                                                              *
*       Published under the GNU LGPL v2.1, see /system/licence_lgpl.txt                                 *
*-------------------------------------------------------------------------------------------------------*
*	$Id$                             *
********************************************************************************************************/

/**
 * Downloads Portal. Generates a list of available downloads
 *
 * @package modul_downloads
 */
class class_modul_downloads_portal extends class_portal implements interface_portal {
	/**
	 * Constructor
	 *
	 * @param mixed $arrElementData
	 */
	public function __construct($arrElementData) {
        $arrModul = array();
		$arrModul["name"] 				= "modul_downloads";
		$arrModul["author"] 			= "<EMAIL>";
		$arrModul["table2"] 			= _dbprefix_."downloads_file";
		$arrModul["table"] 			    = _dbprefix_."downloads_archive";
		$arrModul["table3"] 			= _dbprefix_."downloads_logs";
		$arrModul["moduleId"] 			= _downloads_modul_id_;
		$arrModul["modul"] 			    = "downloads";

		parent::__construct($arrModul, $arrElementData);
	}

	/**
	 * Action-block, controling the behaviour of the class
	 *
	 * @return string
	 */
	public function action() {
	    $strReturn = "";
		$strAction = "";

		if($this->getParam("action") != "")
		    $strAction = $this->getParam("action");

        if($strAction == "detailDownload")
            $strReturn = $this->actionDetailDownload();
        else
            $strReturn = $this->actionList();

		return $strReturn;

	}

//---Aktionsfunktionen-----------------------------------------------------------------------------------

	/**
	 * Creates a list of files & folders
	 *
	 * @return string
	 */
	public function actionList() {
		$strReturn = "";

		//systemid passed?
		if( !validateSystemid($this->getSystemid() ) || $this->getAction() != "openDlFolder" || ! $this->checkSystemidBelongsToCurrentTree() ) {
            if(isset($this->arrElementData["download_id"]))
                $this->setSystemid($this->arrElementData["download_id"]);
		}

        if($this->arrElementData["download_amount"] == "" || $this->arrElementData["download_amount"] < 1)
            $this->arrElementData["download_amount"] = 99999;

        //Load all files
	    $objArraySectionIterator = new class_array_section_iterator($this->getNumberOfEntriesOnLevel());
	    $objArraySectionIterator->setIntElementsPerPage($this->arrElementData["download_amount"]);
	    $objArraySectionIterator->setPageNumber((int)($this->getParam("pv") != "" ? $this->getParam("pv") : 1));
	    $objArraySectionIterator->setArraySection($this->getArrFiles($objArraySectionIterator->calculateStartPos(), $objArraySectionIterator->calculateEndPos()));

	    $arrObjects = $objArraySectionIterator->getArrayExtended();

		$arrObjects = $this->objToolkit->pager($this->arrElementData["download_amount"], ($this->getParam("pv") != "" ? $this->getParam("pv") : 1), $this->getText("weiter"), $this->getText("zurueck"), "", ($this->getParam("page") != "" ? $this->getParam("page") : ""), $arrObjects);



{'fraction_non_alphanumeric': 0.2628502922223887, 'fraction_numerical': 0.007492881762325791, 'mean_word_length': 2.7119021134593995, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 68, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 43, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6643422', 'n_tokens_mistral': 1973, 'n_tokens_neox': 1790, 'n_words': 276}