def transform_url(url, str, page_num):
    """Modifies the URL.

    Args:
        url: Search URL.
        str: Modifier for URL.
        page_num: Number of the page.

    Returns:
        Modified URL.
    """
    url_arr = url.split('?')

    if str == 'category':
        url = url + 'page/{}/'.format(page_num)

    elif str == 'keyword':
        url = ''.join([url_arr[0], 'page/{}/'.format(page_num), '?', url_arr[1]])

    return url