<commit_before><?php

class Algolia_Algoliasearch_Helper_Entity_Pagehelper extends Algolia_Algoliasearch_Helper_Entity_Helper
{
    protected function getIndexNameSuffix()
    {
        return '_pages';
    }

    public function getIndexSettings($storeId)
    {
        return array(
            'attributesToIndex'         => array('slug', 'name', 'unordered(content)'),
            'attributesToSnippet'       => array('content:7')
        );
    }

    public function getPages($storeId)
    {
        $magento_pages = Mage::getModel('cms/page')->getCollection()->addFieldToFilter('is_active',1);

        $ids = $magento_pages->toOptionArray();

        $excluded_pages = array_values($this->config->getExcludedPages());

        foreach ($excluded_pages as &$excluded_page)
            $excluded_page = $excluded_page['pages'];

        $pages = array();

        foreach ($ids as $key => $value)
        {
            if (in_array($value['value'], $excluded_pages))
                continue;

            $page_obj = array();

            $page_obj['slug'] = $value['value'];
            $page_obj['name'] = $value['label'];

            $page = Mage::getModel('cms/page');
            $page->setStoreId($storeId);
            $page->load($page_obj['slug'], 'identifier');

            if (! $page->getId())
                continue;

            $page_obj['objectID'] = $page->getId();

            $page_obj['url'] = Mage::helper('cms/page')->getPageUrl($page->getId());
            $page_obj['content'] = $this->strip($page->getContent());

            $pages[] = $page_obj;
        }

        return $pages;
    }
}<commit_msg>Process template directives for CMS pages<commit_after><?php

class Algolia_Algoliasearch_Helper_Entity_Pagehelper extends Algolia_Algoliasearch_Helper_Entity_Helper
{
    protected function getIndexNameSuffix()
    {
        return '_pages';
    }

    public function getIndexSettings($storeId)
    {
        return array(
            'attributesToIndex'         => array('slug', 'name', 'unordered(content)'),
            'attributesToSnippet'       => array('content:7')
        );
    }

    public function getPages($storeId)
    {
        $magento_pages = Mage::getModel('cms/page')->getCollection()->addFieldToFilter('is_active',1);

        $ids = $magento_pages->toOptionArray();

        $excluded_pages = array_values($this->config->getExcludedPages());

        foreach ($excluded_pages as &$excluded_page)
            $excluded_page = $excluded_page['pages'];

        $pages = array();

        foreach ($ids as $key => $value)
        {
            if (in_array($value['value'], $excluded_pages))
                continue;

            $page_obj = array();

            $page_obj['slug'] = $value['value'];
            $page_obj['name'] = $value['label'];

            $page = Mage::getModel('cms/page');
            $page->setStoreId($storeId);
            $page->load($page_obj['slug'], 'identifier');

            if (! $page->getId())
                continue;

            $tmplProc = Mage::helper('cms')->getPageTemplateProcessor();

            $page_obj['objectID'] = $page->getId();
            $page_obj['url'] = Mage::helper('cms/page')->getPageUrl($page->getId());
            $page_obj['content'] = $this->strip($tmplProc->filter($page->getContent()));

            $pages[] = $page_obj;
        }

        return $pages;
    }
}
{'fraction_non_alphanumeric': 0.15959952885747938, 'fraction_numerical': 0.001177856301531213, 'mean_word_length': 2.4004004004004003, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 37, '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': '1764188', 'n_tokens_mistral': 1018, 'n_tokens_neox': 982, 'n_words': 149}