$database->database_query("UPDATE se_grouptopics SET grouptopic_views=grouptopic_views+1 WHERE grouptopic_id='{$topic_info['grouptopic_id']}' LIMIT 1");
// SET POSTS PER PAGE
$posts_per_page = 10;
// IF GROUPPOST ID IS SET, RESET PAGE
if ($grouppost_id) {
    $previous_posts = $database->database_num_rows($database->database_query("SELECT NULL FROM se_groupposts WHERE grouppost_id<='{$grouppost_id}' AND grouppost_grouptopic_id='{$topic_info['grouptopic_id']}'"));
    if ($previous_posts) {
        $p = ceil($previous_posts / $posts_per_page);
    }
}
// GET TOTAL POSTS
$total_posts = $group->group_post_total(NULL, $topic_info['grouptopic_id']);
// MAKE POST PAGES
$page_vars = make_page($total_posts, $posts_per_page, $p);
// GET GROUP POSTS
$posts = $group->group_post_list($page_vars[0], $posts_per_page, "se_groupposts.grouppost_date ASC", "(se_groupposts.grouppost_grouptopic_id='{$topic_info['grouptopic_id']}')");
// GET CUSTOM GROUP STYLE IF ALLOWED
if ($group->groupowner_level_info['level_group_style']) {
    $groupstyle_info = $database->database_fetch_assoc($database->database_query("SELECT groupstyle_css FROM se_groupstyles WHERE groupstyle_group_id='{$group->group_info['group_id']}' LIMIT 1"));
    $global_css = $groupstyle_info['groupstyle_css'];
}
// SET GLOBAL PAGE TITLE
$global_page_title[0] = 2000314;
$global_page_title[1] = $group->group_info['group_title'];
$global_page_title[2] = $topic_info['grouptopic_subject'];
$global_page_description[0] = 2000313;
$global_page_description[1] = $group->group_info['group_desc'];
// ASSIGN VARIABLES AND INCLUDE FOOTER
$smarty->assign('grouppost_id', $grouppost_id);
$smarty->assign('group', $group);
$smarty->assign('posts', $posts);