<commit_before><?php
abstract class Vps_Component_Renderer_Abstract
{
    private $_enableCache = false;
    private $_stats = array();
    private $_renderComponent;
    private $_cache = array();

    public function setEnableCache($enableCache)
    {
        $this->_enableCache = $enableCache;
    }

    public function renderComponent($component)
    {
        $this->_renderComponent = $component;
        $this->_stats = array(
            'rendered' => array(),
            'cacheSaved' => array(),
            'cachePreloaded' => array(),
            'cacheRendered' => array()
        );
        $this->_cache = array();
        if ($this->_enableCache) {
            $page = $component;
            while ($page && !$page->isPage) $page = $page->parent;
            if ($page) {
                $where = array('page_id' => $page->componentId);
            } else {
                $where = array('page_id' => null);
            }
            $this->_preload($where);
        }
        $view = new Vps_Component_View($this);
        $ret = $this->render($view->component($component));
        if ($this->_enableCache) {
            Vps_Component_Cache::getInstance()->writeBuffer();
        }
        return $ret;
    }

    private function _preload($where)
    {
        $c = Vps_Component_Cache::getInstance()->preload($where);
        foreach ($c as $type => $componentIds) {
            foreach ($componentIds as $componentId => $values) {
                foreach ($values as $value => $content) {
                    $this->_cache[$type][$componentId][$value] = $content;
                }
            }
        }

        $this->_stats['cachePreloaded'] = array();
        foreach ($this->_cache as $type => $componentIds) {<commit_msg>kommentar<commit_after><?php
abstract class Vps_Component_Renderer_Abstract
{
    private $_enableCache = false;
    private $_stats = array();
    private $_renderComponent;
    private $_cache = array();

    public function setEnableCache($enableCache)
    {
        $this->_enableCache = $enableCache;
    }

    public function renderComponent($component)
    {
        $this->_renderComponent = $component;
        $this->_stats = array(
            'rendered' => array(),
            'cacheSaved' => array(),
            'cachePreloaded' => array(),
            'cacheRendered' => array()
        );
        $this->_cache = array();
        if ($this->_enableCache) {
            $page = $component;
            while ($page && !$page->isPage) $page = $page->parent;
            if ($page) {
                $where = array('page_id' => $page->componentId);
            } else {
                $where = array('page_id' => null); //nur bei tests wenn root ein template hat
            }
            $this->_preload($where);
        }
        $view = new Vps_Component_View($this);
        $ret = $this->render($view->component($component));
        if ($this->_enableCache) {
            Vps_Component_Cache::getInstance()->writeBuffer();
        }
        return $ret;
    }

    private function _preload($where)
    {
        $c = Vps_Component_Cache::getInstance()->preload($where);
        foreach ($c as $type => $componentIds) {
            foreach ($componentIds as $componentId => $values) {
                foreach ($values as $value => $content) {
                    $this->_cache[$type][$componentId][$value] = $content;
                }
            }
        }

        $this->_stats['cachePreloaded'] = array();
        foreach ($this->_cache as $type => $componentIds) {
{'fraction_non_alphanumeric': 0.1482943332393572, 'fraction_numerical': 0.0, 'mean_word_length': 1.9890480202190397, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 57, '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': '7039997', 'n_tokens_mistral': 961, 'n_tokens_neox': 948, 'n_words': 198}