I hope you all are doing well.
Yesterday, I was doing some undefined integral exercises when I faced an exercise that was something like:
$$\int \frac{F(\sin(x),\cos(x))}{G(\sin(x), \cos(x))}dx$$
I found that a substitution with $t =\tan(\frac{x}{2})$ would allow me to transform this integral in some $\int \frac{P(t)}{Q(t)}\frac{2}{1+t^{2}}dt$ using the following identities:

What I was wondering a few days ago, was that this identities had a problem when for example I express $\sin(x)$ as a $f(t)$ and $x = \pi$ (in this case $f(t)$ is not defined.). Also the fact that I make a $t =\tan(\frac{x}{2})$ restricts $\pi$ from the domain of the resulting $F(u)$ such that $F'(t) = f(t)$ so... What happens when I make a substitution $u = s(x)$ such that the domain of that function excludes some elements of the function I'm integrating? And also, what happens with the identities if $x = \pi$?
I hope to have expressed myself correctly. I do not speak english so feel free to improve my writing and sorry if there are grammar mistakes.
Thanks.
Suppose this substitution achieves $f(x)dx=g(t)dt$. For $a<\pi$,$$\int_a^\pi f(x)dx=\lim_{y\to\pi^-}\int_a^yf(x)dx=\lim_{y\to\pi^-}\int_{\tan(a/2)}^{\tan(y/2)}g(t)dt=\int_{\tan(a/2)}^\infty g(t)dt.$$You can treat limits of integration above $\pi$ with one-sided limits in a similar way: if $a>\pi$,$$\int_\pi^af(x)dx=\lim_{y\to\pi^+}\int_y^af(x)dx=\lim_{y\to\pi^+}\int_{\tan(y/2)}^{\tan(a/2)}g(t)dt=\int_{-\infty}^{\tan(a/2)}g(t)dt.$$