public static function blogEntry($author_id = '',$entry_id = '')
	{
	    $entry = new Entry();
        $min_access = Application::user()->minAccessLevel();
        $access = $entry->also('Access');
        $access->clause('access_level',$min_access,Clause::GTE);
	    
	    if(Application::user()->id())
	    {
	        $lbk_user = $entry->also('LogbookUser');
                $lbk_user->clauseSafe('user_id',Application::user()->id());
	    }

	    if($author_id)
	        $entry->clauseSafe('author_id',Logbook::current()->authorId());

	        $entry->maybe('BlogTag');
            
            if(!$entry_id)
                $entry_id = Application::param('entry_id');

            if($entry_id&&$author_id)
	        $entry->clauseSafe('entry_id',$entry_id);

            $entry->order('entry_date');
            
            /*$entry->order('author_id');
            $entry->order('entry_id');*/
            $entry->maybe('Comment');
            $entry->descending();
            
            try
            {
	        $page = $entry->page(1,1);
	        $ret = current($page->objects());
	        Logbook::current()->setAuthorId($ret->get('author_id'));
            }
            
            catch(Exception $exc)
            {
                $ret = new Entry();
            }
	    
	    return $ret;
        }
    protected function entryToEdit()
	{
	    if(!is_object($this->entry_to_edit))
	    {
    	        $fetch = new Entry();
    	        $fetch->maybe('BlogTag');
    	        $fetch->noForeign();
    	        $fetch->clauseSafe('author_id',Logbook::current()->authorId());
    	    
    	        if($id = Application::param('entry_id'))
    	            $fetch->clauseSafe('entry_id',Application::param('entry_id'));
    	        else
    	            throw new AccessDeniedException('Tried to edit an empty entry id');
    	        
    	        $this->entry_to_edit = $fetch;
	    }
            
	    return $this->entry_to_edit;
        }
	protected function blogEntries()
	{
            $entry = new Entry();
            $entry->clause('author_id',Application::param('author_id'));
	    $entry->order($this->order_by);
	    
	    if($this->descending)
	        $entry->descending();

	    $entry->maybe('Comment');

            try
            {
                $ret = $entry->page($this->page_num,$this->num_per_page);
            }
            
            catch(Exception $e)
            {
                $ret = false;
            }

	    return $ret;
	}