/**
 * Print the amount of issues for each specified status in the user row of the plugin table
 *
 * @param $data_row
 * @param $stat_issue_count
 * @param $group_index
 * @param $print
 * @return mixed
 */
function print_amount_of_issues($data_row, $group_index, $stat_issue_count, $print)
{
    $user_id = $data_row['user_id'];
    for ($stat_index = 1; $stat_index <= userprojectapi::get_stat_count(); $stat_index++) {
        $stat_spec_status_ign = plugin_config_get('CStatIgn' . $stat_index);
        $temp_stat_issue_count = userprojectapi::calc_group_spec_amount($data_row, $group_index, $stat_index);
        $stat_issue_count_threshold = plugin_config_get('IAMThreshold' . $stat_index);
        $stat_status_id = plugin_config_get('CStatSelect' . $stat_index);
        $stat_issue_count[$stat_index] += $temp_stat_issue_count;
        /** group 2 -> mark all cells where issue count > 0 */
        if (!userprojectapi::check_user_id_is_enabled($user_id) && $temp_stat_issue_count > 0 && $group_index != 3) {
            echo '<td class="group_row_bg" style="background-color:' . plugin_config_get('TAMHBGColor') . '">';
        } else {
            if ($stat_issue_count_threshold <= $temp_stat_issue_count && $stat_issue_count_threshold > 0) {
                echo '<td style="background-color:' . plugin_config_get('TAMHBGColor') . '">';
            } else {
                echo '<td style="background-color:' . get_status_color($stat_status_id, null, null) . '">';
            }
        }
        if (!$print && $temp_stat_issue_count > 0) {
            $assigned_project_id = $data_row['assigned_project_id'];
            $target_version_id = $data_row['target_version_id'];
            $target_version = '';
            if (strlen($target_version_id) > 0) {
                $target_version = version_get_field($target_version_id, 'version');
            }
            $filter_string = '<a href="search.php?project_id=' . $assigned_project_id . '&amp;status_id=' . $stat_status_id;
            if ($group_index != 3 || $stat_spec_status_ign == OFF && $group_index == 3) {
                $filter_string .= '&amp;handler_id=' . userprojectapi::get_link_user_id($data_row['user_id']);
            }
            $filter_string .= '&amp;sticky_issues=on' . '&amp;target_version=' . $target_version . '&amp;sortby=last_updated' . '&amp;dir=DESC' . '&amp;hide_status_id=-2' . '&amp;match_type=0">';
            echo $filter_string;
            echo $temp_stat_issue_count;
            echo '</a>';
        } else {
            echo $temp_stat_issue_count;
        }
        echo '</td>' . PHP_EOL;
    }
    return $stat_issue_count;
}