<commit_before><?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Playlist extends CI_Controller {
	
	function __construct(){
		parent::__construct();
		$this->load->database();
	}
	/**
	 * User index
	 * @param number $page
	 */
	public function index($page=1)
	{
		$login_uid = rbac_conf(array('INFO','uid')); 

		$cnt_query = $this->db->query("SELECT COUNT(*) AS cnt FROM Playlist WHERE uid = '{$login_uid}'");
		$cnt_data = $cnt_query->row_array();
		//page
		
		$this->load->library('pagination');
		$config['base_url'] = site_url("playlist/playlist/index");
		$config['total_rows'] = $cnt_data['cnt'];
		$config['per_page']   = 10;
		$config['uri_segment']= '4';
		$config['num_links']='2';
		$config['first_link'] = 'First';
		$config['last_link'] = 'last';
		$config['use_page_numbers'] = TRUE;
		$this->pagination->initialize($config);
		
		$query = $this->db->query("SELECT * FROM Playlist WHERE uid = '{$login_uid}' LIMIT ".(($page-1)*$config['per_page']).",".$config['per_page']."");
		$data = $query->result();
		
		$this->load->view("playlist/index",array("data"=>$data));
	}
	/**
	 * Edit users
	 * @param number $uid
	 */
	
	public function see_all_songs($pid){
		$query = $this->db->query("");

	}
	 
	public function edit($pid){
		$login_uid = rbac_conf(array('INFO','uid')); 
		$name_query = $this->db->query("SELECT name FROM Playlist WHERE uid = '{$login_uid}'");
		$name_data = $name_query->row_array();
		if($this->input->post()){
			$fullname = $this->input->post("name");
			if($name){
				$query = $this->db->query("SELECT * FROM Playlist WHERE uid = '{$uid}'");
				$data = $query->row_array();
				if(!$data){
					$created_date = date('Y-m-d');
					$sql = "INSERT INTO Playlist (uid,name,created_date) values('{$uid}','{$name}','{$created_date}')";
					$this->db->query($sql);
					success_redirct("playlist/playlist/index","Add successful!");
					
				}else{
					error_redirct("","The playlist's name already exists!");<commit_msg>Update playlist.php<commit_after><?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Playlist extends CI_Controller {
	
	function __construct(){
		parent::__construct();
		$this->load->database();
	}
	/**
	 * User index
	 * @param number $page
	 */
	public function index($page=1)
	{
		$login_uid = rbac_conf(array('INFO','uid')); 

		$cnt_query = $this->db->query("SELECT COUNT(*) AS cnt FROM Playlist WHERE uid = '{$login_uid}'");
		$cnt_data = $cnt_query->row_array();
		//page
		
		$this->load->library('pagination');
		$config['base_url'] = site_url("playlist/playlist/index");
		$config['total_rows'] = $cnt_data['cnt'];
		$config['per_page']   = 10;
		$config['uri_segment']= '4';
		$config['num_links']='2';
		$config['first_link'] = 'First';
		$config['last_link'] = 'last';
		$config['use_page_numbers'] = TRUE;
		$this->pagination->initialize($config);
		
		$query = $this->db->query("SELECT * FROM Playlist WHERE uid = '{$login_uid}' LIMIT ".(($page-1)*$config['per_page']).",".$config['per_page']."");
		$data = $query->result();
		
		$this->load->view("playlist/index",array("data"=>$data));
	}
	/**
	 * Edit users
	 * @param number $uid
	 */
	
	public function see_all_songs($pid){
		$query = $this->db->query("");

	}
	 
	public function edit($pid){
		$login_uid = rbac_conf(array('INFO','uid')); 
		$name_query = $this->db->query("SELECT name FROM Playlist WHERE uid = '{$login_uid}'");
		$name_data = $name_query->row_array();
		if($this->input->post()){
			$name = $this->input->post("name");
			if($name){
				$query = $this->db->query("SELECT * FROM Playlist WHERE uid = '{$login_uid}'");
				$data = $query->row_array();
				if(!$data){
					$created_date = date('Y-m-d');
					$sql = "INSERT INTO Playlist (uid,name,created_date) values('{$uid}','{$name}','{$created_date}')";
					$this->db->query($sql);
					success_redirct("playlist/playlist/index","Add successful!");
					
				}else{
					error_redirct("","The playlist's name already exists!");
{'fraction_non_alphanumeric': 0.22736368184092046, 'fraction_numerical': 0.0030015007503751876, 'mean_word_length': 4.608695652173913, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 61, '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': '1779984', 'n_tokens_mistral': 1568, 'n_tokens_neox': 1379, 'n_words': 248}