Get paged category link programmatically

This the code I have so far which looks like it does the job, I still wonder if there is a API function for the job:

/**
 * @param (int) $category_id
 * @param (int) $pagenum
 * @return string
 */
function get_category_paged_link($category_id, $pagenum)
{
    global $wp_rewrite;

    $link = get_category_link($category_id);

    if ($wp_rewrite->using_permalinks() || $wp_rewrite->using_index_permalinks())
    {
        $link = sprintf
        (
            '%s/%s/%d/',
            rtrim($link, "https://wordpress.stackexchange.com/"),
            $wp_rewrite->pagination_base,
            $pagenum
        );
    }
    else
    {
        if (false === strpos($link, '?'))
            $link .= '?';
        else
            $link .= '&';
        $link .= sprintf('paged=%d', $pagenum);
    }

    return $link;
}

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş