<commit_before><?php

class adminportalmodel extends CI_Model{

	public function __construct(){

		parent::__construct();

		$this->load->database();

		$this->load->library('session');

	}

	public function homeData($status_param=1){

		$query = "select * from `posts_temp` where `status`='$status_param'"; // get all the posts that are awaiting moderation

		$res = $this->db->query($query);

		$res = $res->result_array();

		return $res;
	}

	public function postData($postid){
		
		$query = "select * from `posts_temp` where `postid`='$postid'"; // get all the posts that are awaiting moderation

		$res = $this->db->query($query);

		$res = $res->result_array();

		return $res[0];

	}

	public function editstatus($postid, $status){

		$query = "update posts_temp set status='$status' where postid='$postid'"; // get all the posts that are awaiting moderation

		if($res = $this->db->query($query))<commit_msg>In the query that fetches all the posts from the DB, added the order by postid DESC condition. So that the latest posts are always on the top.<commit_after><?php

class adminportalmodel extends CI_Model{

	public function __construct(){

		parent::__construct();

		$this->load->database();

		$this->load->library('session');

	}

	public function homeData($status_param=1){

		$query = "select * from `posts_temp` where `status`='$status_param' order by `postid` desc"; // get all the posts that are awaiting moderation

		$res = $this->db->query($query);

		$res = $res->result_array();

		return $res;
	}

	public function postData($postid){
		
		$query = "select * from `posts_temp` where `postid`='$postid'"; // get all the posts that are awaiting moderation

		$res = $this->db->query($query);

		$res = $res->result_array();

		return $res[0];

	}

	public function editstatus($postid, $status){

		$query = "update posts_temp set status='$status' where postid='$postid'"; // get all the posts that are awaiting moderation

		if($res = $this->db->query($query))
{'fraction_non_alphanumeric': 0.15659617321248742, 'fraction_numerical': 0.002014098690835851, 'mean_word_length': 4.4289617486338795, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '2478608', 'n_tokens_mistral': 686, 'n_tokens_neox': 607, 'n_words': 186}