<commit_before><?php
/**
 * @version		$Id: weblinks.php 1291 2011-05-16 22:13:45Z johanjanssens $
 * @package     Nooku_Server
 * @subpackage  Pages
 * @copyright	Copyright (C) 2011 - 2012 Timble CVBA and Contributors. (http://www.timble.net)
 * @license		GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link		http://www.nooku.org
 */

/**
 * Pages Module Html Class
 *
 * @author    	<NAME> <http://nooku.assembla.com/profile/gergoerdosi>
 * @package     Nooku_Server
 * @subpackage  Pages
 */
class ComPagesModuleMenuHtml extends ComDefaultModuleDefaultHtml
{
    public function display()
    {
        $user     = JFactory::getUser();
        
        $start    = $this->module->params->get('start_level');
        $end      = $this->module->params->get('end_level');
        $children = $this->module->params->get('show_children', 'active');
        $pages    = $this->getService('application.pages');
        
        $groups = array();
        
        // Prevent groups from being loaded when no user is logged in
        if($user->id) {
        	$groups = $this->getService('com://admin/users.model.groups_users')->user($user->id)->getList()->users_group_id;
        }
        
        // If we do not add an empty element to the array public pages will be filtered out
        $groups[] .= '';

        $this->active = $pages->getActive();
        $this->pages  = $pages->find(array('pages_menu_id' => $this->module->params->get('menu_id'), 'hidden' => 0, 'users_group_id' => $groups));

        foreach(clone $this->pages as $page)
        {
            $extract = false;
            
            // Extract if level is lower than start.
            if($page->level < $start) {
                $extract = true;
            }
            
            // Extract if level is higher than end.
            if(!$extract && $end > $start && $page->level > $end) {
                $extract = true;
            }
            
            // Extract if path is not in the active branch.<commit_msg>Fixed pages filtering issue on menus.<commit_after><?php
/**
 * @version		$Id: weblinks.php 1291 2011-05-16 22:13:45Z johanjanssens $
 * @package     Nooku_Server
 * @subpackage  Pages
 * @copyright	Copyright (C) 2011 - 2012 Timble CVBA and Contributors. (http://www.timble.net)
 * @license		GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link		http://www.nooku.org
 */

/**
 * Pages Module Html Class
 *
 * @author    	<NAME> <http://nooku.assembla.com/profile/gergoerdosi>
 * @package     Nooku_Server
 * @subpackage  Pages
 */
class ComPagesModuleMenuHtml extends ComDefaultModuleDefaultHtml
{
    public function display()
    {
        $user     = JFactory::getUser();
        
        $start    = $this->module->params->get('start_level');
        $end      = $this->module->params->get('end_level');
        $children = $this->module->params->get('show_children', 'active');
        $pages    = $this->getService('application.pages');

        if($user->id) {
        	$groups = $this->getService('com://admin/users.model.groups_users')->user($user->id)->getList()->users_group_id;
        } else {
            $groups = array();
        }

        // Make sure that pages without an assigned group are also included.
        $groups[] = 0;

        $this->active = $pages->getActive();
        $this->pages  = $pages->find(array('pages_menu_id' => $this->module->params->get('menu_id'), 'hidden' => 0, 'users_group_id' => $groups));

        foreach(clone $this->pages as $page)
        {
            $extract = false;
            
            // Extract if level is lower than start.
            if($page->level < $start) {
                $extract = true;
            }
            
            // Extract if level is higher than end.
            if(!$extract && $end > $start && $page->level > $end) {
                $extract = true;
            }
            
            // Extract if path is not in the active branch.
{'fraction_non_alphanumeric': 0.15191478569617042, 'fraction_numerical': 0.014455997971088003, 'mean_word_length': 2.0740452065471553, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 71, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, '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': '5623445', 'n_tokens_mistral': 1252, 'n_tokens_neox': 1177, 'n_words': 269}