<commit_before><?php
namespace Model;

define('ITEM_NUM', '10');

class Biztechpre extends \Model
{

        private static function get_post_data_descending_order()
        {
                $query = \DB::select('id', 'name', 'mail_address', 'comment', 'post_time')
                        ->from('posting')
                        ->order_by('post_time', 'dec')
                        ->execute();
                return $query->as_array();
        }

        public static function get_contents_page($page){
            $page--;  // page num to index
            $lists = Biztechpre::get_post_data_descending_order();
            $contents = '';
            $c = 0;
            foreach($lists as $item){
                if($page*ITEM_NUM <= $c && $c < ($page+1)*ITEM_NUM){
                    $contents .= "
                    <div class=\"row\">
                        <hr>
                        <div class=\"no\">{$item['id']}</div>
                        <div class=\"name\">{$item['name']}</div>
                        <div class=\"mail_address\">{$item['mail_address']}</div>
                        <div class=\"post_time\">{$item['post_time']}</div>
                        <div class=\"comment\">{$item['comment']}</div>
                    </div>
                        ";
                }
                $c ++;
            }
            return $contents;
        }

        public static function get_page_link($pageNum)
        {
            $lists = Biztechpre::get_post_data_descending_order();
            $contents = '';

            for($link=1; $link<=ceil(count($lists)/ITEM_NUM); $link++){
                if($link == $pageNum){
                    $contents .= $link;
                }else{
                    $url = "bbs/$link";
                    $contents .= \Html::anchor($url, $link);
                }
                $contents .= ' ';
            }
            return $contents;
        }

}

<commit_msg>modified: add link to Top page<commit_after><?php
namespace Model;

define('ITEM_NUM', '10');

class Biztechpre extends \Model
{

        private static function get_post_data_descending_order()
        {
                $query = \DB::select('id', 'name', 'mail_address', 'comment', 'post_time')
                        ->from('posting')
                        ->order_by('post_time', 'dec')
                        ->execute();
                return $query->as_array();
        }

        public static function get_contents_page($page){
            $page--;  // page num to index
            $lists = Biztechpre::get_post_data_descending_order();
            $contents = '';
            $num = 0;
            $c = 0;
            foreach($lists as $item){
                if($page*ITEM_NUM <= $c && $c < ($page+1)*ITEM_NUM){
                    $contents .= "
                    <div class=\"row\">
                        <hr>
                        <div class=\"no\">{$item['id']}</div>
                        <div class=\"name\">{$item['name']}</div>
                        <div class=\"mail_address\">{$item['mail_address']}</div>
                        <div class=\"post_time\">{$item['post_time']}</div>
                        <div class=\"comment\">{$item['comment']}</div>
                    </div>
                        ";
                    $num ++;
                }
                if(ITEM_NUM <= $num)break;
                $c ++;
            }
            return $contents;
        }

        public static function get_page_link($pageNum)
        {
            $lists = Biztechpre::get_post_data_descending_order();
            $contents = \Html::anchor('', 'Top').' ';

            for($link=1; $link<=ceil(count($lists)/ITEM_NUM); $link++){
                if($link == $pageNum){
                    $contents .= $link;
                }else{
                    $url = "bbs/$link";
                    $contents .= \Html::anchor($url, $link);
                }
                $contents .= ' ';
            }
            return $contents;
        }

}


{'fraction_non_alphanumeric': 0.15802530389481517, 'fraction_numerical': 0.0027288514016373107, 'mean_word_length': 1.2153846153846153, 'pattern_counts': {'":': 0, '<': 38, '<?xml version=': 0, '>': 37, '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': '2476206', 'n_tokens_mistral': 1101, 'n_tokens_neox': 1047, 'n_words': 186}