public static function get_chat_log()
 {
     /*return Chat_log::all(array(
                   "select"    => "chat_log.*, users.username as username, users.display_name as display_name",
                   "limit"     => 50,
                   "joins"     => "left join users on chat_log.user_id = users.id",
     		"order"		=> "id desc"
               )
           );*/
     $query = "SELECT * FROM (\r\n\t\t\tSELECT chat_log.*, users.username AS username, users.display_name AS display_name FROM chat_log LEFT JOIN users ON users.id = chat_log.user_id ORDER BY id DESC LIMIT 50\r\n\t\t) sub\r\n\t\tORDER BY id ASC";
     return Chat_log::find_by_sql($query);
 }
 public function get_chat()
 {
     $this->content_view = 'ajax/chat_log';
     $this->data['chat'] = Chat_log::get_chat_log();
 }