function _process_result_array($arr)
  {
    if(complex_array :: get_max_column_value('hosts', $arr, $index) !== false)
      $arr[$index]['max_hosts'] = 1;

    if(complex_array :: get_max_column_value('hits', $arr, $index) !== false)
      $arr[$index]['max_hits'] = 1;

    if(complex_array :: get_max_column_value('home_hits', $arr, $index) !== false)
      $arr[$index]['max_home_hits'] = 1;

    if(complex_array :: get_max_column_value('audience', $arr, $index) !== false)
      $arr[$index]['max_audience'] = 1;

    $result = array();
    foreach($arr as $index => $data)
    {
      if(date('w', $data['time']+60*60*24) == 1)
        $data['new_week'] = 1;

      $result[$index] = $data;
    }

    return $result;
  }
	function _check_proper_nesting_strict($nodes, $level_limit=-1, $line='')
	{
		$l = complex_array :: get_min_column_value('l', $nodes, $index);
		$r = complex_array :: get_max_column_value('r', $nodes, $index);
		$node = current($nodes);
		
		$this->assertEqual($node['l'], $l, 
			'l is invalid: ' . $node['l'] . ' , expected : ' . $l . ' at line: ' . $line);

		$this->assertEqual($node['r'], $r, 
			'r is invalid: ' . $node['r'] . ' , expected : ' . $r . ' at line: ' . $line);
		
		$children = ($r - $l - 1)/2;
		
		if($children > 0)
		{
			$last_r = $this->_check_proper_nesting_recursive($nodes, $line, $l, $r, $children, $level_limit-1);
			
			if($last_r !== false && sizeof($nodes) > $level_limit)
				$this->assertEqual($node['r'] - $last_r, 1,
					'there is a gap between r ' . $node['r'] . ' and r ' . $last_r . ' at line: ' . $line);
		}
	}