<commit_before><?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Track extends MY_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see https://codeigniter.com/user_guide/general/urls.html
	*/
	public function add($index = NULL)
	{
            $this->load->library('media');
            if (empty($index)) {
                $pages = $this->media->items();
                $this->load->view('admin', array('page' => $this->load->view('media/form/item', array(
                    'index' => count($pages),
                    'title' => '', 
                    'link' => '', 
                    'audio' => '', 
                    'background' => '#000000', 
                    'fontcolor' => '#ffffff',
                    'type' => 'slide', 
                    'gallery' => ''
                    ), TRUE)));
            } else {
                $page = $this->media->get($index);
                $gallery_items = array();
                foreach($page->items as $item) {
                    $gallery_items[] = $this->load->view('media/form/gallery/item', array('page' => $index, 'src' => $item), TRUE);
                }
                $page->gallery = implode('', $gallery_items);
                
                $this->load->view('admin', array('page' => $this->load->view('media/form/item', $page, TRUE)));
            }
	}
	public function index()
	{
            $this->load->library('media');
            $items = $this->media->items();
            $gallery_items = array();
            foreach($items as $item) {
                $gallery_items[] = $this->load->view('media/item', $item, TRUE);
            }
            $gallery = $this->load->view('gallery', array('items' => implode('', $gallery_items)), TRUE);
            $this->load->view('admin', array('page' => $gallery));
	}
        public function update() {
            $this->load->library('media');
            $pages = $this->media->items();
            $currentPages = array_map(function($item) {return $item->link;}, $pages);
            $postpages = $this->input->post('media');
            if (empty($postpages)) $postpages = array();
            $toDelete = array_diff_key(array_flip($currentPages), array_flip($postpages));
            foreach(array_flip($toDelete) as $link) {
                $this->media->del($link);
            }
            foreach($pages as $item) {
                foreach($postpages as $pageindex => $pagelink) {
                    if ($pagelink === $item->link) {
                        $item->index = $pageindex;
                        $this->page->set($item->link, $item);
                    }
                }
            }
        }
}
<commit_msg>Update Track.php<commit_after><?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Track extends MY_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see https://codeigniter.com/user_guide/general/urls.html
	*/
	public function index()
	{
            $this->load->view('admin', array('page' => 'asdadsa'));
	}
        public function update() {
            $this->load->library('media');
            $pages = $this->media->items();
            $currentPages = array_map(function($item) {return $item->link;}, $pages);
            $postpages = $this->input->post('media');
            if (empty($postpages)) $postpages = array();
            $toDelete = array_diff_key(array_flip($currentPages), array_flip($postpages));
            foreach(array_flip($toDelete) as $link) {
                $this->media->del($link);
            }
            foreach($pages as $item) {
                foreach($postpages as $pageindex => $pagelink) {
                    if ($pagelink === $item->link) {
                        $item->index = $pageindex;
                        $this->page->set($item->link, $item);
                    }
                }
            }
        }
}

{'fraction_non_alphanumeric': 0.16499251976918144, 'fraction_numerical': 0.0012823252831801668, 'mean_word_length': 1.8108108108108107, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 80, 'https://': 2, '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': '1674641', 'n_tokens_mistral': 1378, 'n_tokens_neox': 1281, 'n_words': 270}