code: func pagedURL(r *http.Request, limit int, cursor string) string {
  	if limit == 0 {
  		limit = GetLimit(r, -1)
  		if limit < 0 {
  			limit = 0
  		}
  	}
  	values := r.URL.Query()
  	switch cursor {
  	case "EMPTY":
  		values.Del("cursor")
  	case "":
  		// Do nothing, just leave the cursor in.
  	default:
  		values.Set("cursor", cursor)
  	}
  	switch {
  	case limit < 0:
  		values.Del("limit")
  	case limit > 0:
  		values.Set("limit", fmt.Sprintf("%d", limit))
  	}
  	result := *r.URL
  	result.RawQuery = values.Encode()
  	return result.String()
  }
docs: // pagedURL returns a self URL with the given cursor and limit paging options.
  // if limit is set to 0, then inherit whatever limit is set in request.  If
  // both are unspecified, then limit is omitted.