Unusual improper integral I was looking for exercises on improper integrals and saw this problem

Evaluate the following integral $$I=\int_0^2 \frac{dx}{\sqrt{\left| 1-x^2\right|}}$$

To begin, I graphed the function $f(x) = \frac{1}{\sqrt{\left| 1-x^2\right|}}$ and saw that it has an asymptote at $x=1$, so I decided to split the integral into
$$\int_0^1 \frac{dx}{\sqrt{\left| 1-x^2\right|}}+\int_1^2 \frac{dx}{\sqrt{\left| 1-x^2\right|}}$$
For the first integral it's quite easy for me to see that the first integral will evaluate to $\pi/2$. But the problem starts when I try to evaluate the second integral. Specifically when I change its bounds. If I let $x=\sin\theta$ and $dx = \cos\theta d\theta$, I'd get
$$\int_{\pi/2}^{\arcsin 2} \frac{\cos \theta d\theta}{\left| \cos \theta \right|}$$
The main problem here is $\arcsin 2$, it's not a real value. As far as I know, the original integral had a real integrand and a real bound, so the result should be a real value, but when the substution comes in, it turns complex. Am I doing something wrong? Is there a way to evaluate this second integral?

$$
\begin{aligned}
I &=\int_0^2 \frac{d x}{\sqrt{\left|1-x^2\right|}} \\
&=\int_0^1 \frac{d x}{\sqrt{1-x^2}}+\int_1^2 \frac{d x}{\sqrt{x^2-1}} \\
&=\left[\sin ^{-1} x\right]_0^1+ [\ln |\sec \theta+\tan \theta|]_{\sec ^{-1} 1}^{\sec ^{-1} 2} \quad (\textrm{ By letting  }x=\sec \theta) \\
&=\frac{\pi}{2}+\ln (2+\sqrt{3})
\end{aligned}
$$
