<commit_before><?php
class News extends CI_Controller {

        public function __construct()
        {
                parent::__construct();
                $this->load->model('news_model');
//                $this->load->helper('url_helper');
        }

        public function index()
        {
                $data['news'] = $this->news_model->get_news();
				$data['title'] = 'News archive';

                $this->load->view('templates/header', $data);
                $this->load->view('news/index2', $data);
                $this->load->view('templates/footer');
        }

        public function view($slug = NULL)
        {
                $data['news_item'] = $this->news_model->get_news($slug);

                 if (empty($data['news_item']))
				{
						//show_404();
						/* just assuming this because there is no data*/
						echo "No news is good news";
				}

				$data['title'] = $data['news_item']['title'];
		
				$this->load->view('templates/header', $data);
				$this->load->view('news/view', $data);
				$this->load->view('templates/footer');
		}
		public function create()
		{
			$this->load->helper('form');
			$this->load->library('form_validation');
		
			$data['title'] = 'Create a news item';
		
			$this->form_validation->set_rules('title', 'Title', 'required');
			$this->form_validation->set_rules('text', 'Text', 'required');
		
			if ($this->form_validation->run() === FALSE)
			{
				$this->load->view('templates/header', $data);
				$this->load->view('news/create');
				$this->load->view('templates/footer');
		
			}
			else
			{
				$this->news_model->set_news();
				$this->load->view('news/success');
			}
		}
}<commit_msg>Create news form added to index<commit_after><?php
class News extends CI_Controller {

        public function __construct()
        {
                parent::__construct();
                $this->load->model('news_model');
//                $this->load->helper('url_helper');
        }

        public function index()
        {
                $this->load->helper('form');
                $this->load->library('form_validation');
                $data['news'] = $this->news_model->get_news();
				$data['title'] = 'News archive';

//                $this->load->view('templates/header', $data);
//                $this->load->view('news/index2', $data);
//                $this->load->view('templates/footer');

                $this->form_validation->set_rules('title', 'Title', 'required');
                $this->form_validation->set_rules('text', 'Text', 'required');

                if ($this->form_validation->run() === FALSE)
                {
                    $this->load->view('templates/header', $data);
                    $this->load->view('news/index2', $data);
                    $this->load->view('templates/footer');

                }
                else
                {
                    $this->news_model->set_news();
                    $this->load->view('templates/header', $data);
                    $this->load->view('news/index2', $data);
                    $this->load->view('templates/footer');
                }
        }

        public function view($slug = NULL)
        {
                $data['news_item'] = $this->news_model->get_news($slug);

                 if (empty($data['news_item']))
				{
						//show_404();
						/* just assuming this because there is no data*/
						echo "No news is good news";
				}

				$data['title'] = $data['news_item']['title'];
		
				$this->load->view('templates/header', $data);
				$this->load->view('news/view', $data);
				$this->load->view('templates/footer');
		}
		public function create()
		{
			$this->load->helper('form');
			$this->load->library('form_validation');
		
			$data['title'] = 'Create a news item';
		
			$this->form_validation->set_rules('title', 'Title', 'required');
			$this->form_validation->set_rules('text', 'Text', 'required');
		
			if ($this->form_validation->run() === FALSE)
			{
				$this->load->view('templates/header', $data);
				$this->load->view('news/create');
				$this->load->view('templates/footer');
		
			}
			else
			{
				$this->news_model->set_news();
                $this->load->view('news/success', $data);

			}
		}

        public function create2()
        {
            $this->load->helper('form');
            $this->load->library('form_validation');

            $data['title'] = 'Create a news item';

            $this->form_validation->set_rules('title', 'Title', 'required');
            $this->form_validation->set_rules('text', 'Text', 'required');

            if ($this->form_validation->run() === FALSE) {
                $this->load->view('templates/header', $data);
                $this->load->view('news/create');
                $this->load->view('templates/footer');

            } else {
                $this->news_model->set_news();
                $this->load->view('templates/header', $data);
                $this->load->view('news/index2', $data);
                $this->load->view('templates/footer');
            }
        }
		public function register()
		{
			$this->load->helper('form');
			$this->load->library('form_validation');

			$data['title'] = 'Register';

			$this->form_validation->set_rules('email', 'Email', 'required');
			$this->form_validation->set_rules('pwd', 'Pwd', 'required');

			if ($this->form_validation->run() === FALSE)
			{
				$this->load->view('templates/header', $data);
				$this->load->view('news/register');
				$this->load->view('templates/footer');

			}
			else
			{
				$this->news_model->set_news();
				$this->load->view('news/success');
			}
		}
}
{'fraction_non_alphanumeric': 0.19936034115138593, 'fraction_numerical': 0.0021321961620469083, 'mean_word_length': 2.123751387347392, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 151, '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': '499536', 'n_tokens_mistral': 1899, 'n_tokens_neox': 1621, 'n_words': 242}