Evaluation of a log-trig integral in terms of the Clausen function (or other functions related to the dilogarithm) 
Define the function $\mathcal{I}:\mathbb{R}^{2}\rightarrow\mathbb{R}$ via the definite integral
$$\mathcal{I}{\left(a,\theta\right)}:=\int_{0}^{\theta}\mathrm{d}\varphi\,\ln{\left(1-2a\cos{\left(\varphi\right)}+a^{2}\right)}.\tag{1}$$
The integral $\mathcal{I}$ can in general be evaluated in terms of elementary functions and the dilogarithm function of a complex argument, which is typically defined on the cut complex plane by the integral representation
$$\operatorname{Li}_{2}{\left(z\right)}:=-\int_{0}^{z}\mathrm{d}x\,\frac{\ln{\left(1-x\right)}}{x};~~~\small{z\in\mathbb{C}\setminus\left(1,\infty\right)},\tag{2a}$$
where the natural logarithm of a complex variable is defined by its own integral representation
$$\ln{\left(z\right)}:=\int_{1}^{z}\mathrm{d}x\,\frac{1}{x};~~~\small{z\in\mathbb{C}\setminus\left(-\infty,0\right]}.\tag{2b}$$

Recall that the Clausen function (of order $2$) is defined for real arguments via the integral representation
$$\operatorname{Cl}_{2}{\left(\theta\right)}:=-\int_{0}^{\theta}\mathrm{d}\varphi\,\ln{\left(\left|2\sin{\left(\frac{\varphi}{2}\right)}\right|\right)};~~~\small{\theta\in\mathbb{R}}.\tag{3a}$$
Another auxiliary function related to the dilogarithm is what I'll refer to here as the "two-variable dilogarithm", defined by the integral representation
$$\operatorname{Li}_{2}{\left(r,\theta\right)}:=-\frac12\int_{0}^{r}\mathrm{d}x\,\frac{\ln{\left(1-2x\cos{\left(\theta\right)}+x^{2}\right)}}{x};~~~\small{\left(r,\theta\right)\in\mathbb{R}^{2}}.\tag{3b}$$
Note: For $\left|r\right|<1$, $\Re{\left[\operatorname{Li}_{2}{\left(r\exp{i\theta}\right)}\right]}=\operatorname{Li}_{2}{\left(r,\theta\right)}$.
It turns out that any dilogarithm of a complex variable can be expressed in terms of the Clausen function and the two-variable dilogarithm. As such, we should be able to find a manifestly real expression for the integral $\mathcal{I}$ in terms of these functions.
Problem: Given $\left(a,\theta\right)\in\mathbb{R}^{2}$, find a closed-form expression for $\mathcal{I}{\left(a,\theta\right)}$ in terms of elementary functions, Clausen functions, and the two-variable dilogarithm.

 A: Without any assumptions, a CAS gives
$$\mathcal{I}{\left(a,\theta\right)}:=i\frac{ \pi  \sqrt{-\frac{(a-1)^2}{a^2}} a \log (a)}{a-1}+\theta  \log \left(-a e^{-i
   \theta }\right)+i\frac{ \theta ^2}{2}+$$ $$\frac{1}{6} i \left( \text{Li}_2\left(\frac{e^{i \theta
   }}{a}\right)+ \text{Li}_2\left(a e^{i \theta }\right)+\frac 12 \log ^2(a)-\frac { \pi
   ^2}3\right)$$ which can further be simplified depending on the range for $a$.
A: Assume first that $a > 1$. Then
\begin{align*}
\mathcal{I}(a,\theta)
&= 2 \operatorname{Re} \int_{0}^{\theta} \mathrm{d}\varphi \, \log(a - e^{i\varphi}) \\
&= 2 \operatorname{Re} \biggl( \frac{1}{i} \int_{1}^{e^{i\theta}} \mathrm{d}z \, \frac{\log(a - z)}{z} \biggr),
\end{align*}
where $z = e^{i\varphi}$ and the last integral is taken along the circular arc joining $1$ and $e^{i\theta}$. Now by substituting $z = aw$,
\begin{align*}
\mathcal{I}(a,\theta)
&= 2 \operatorname{Im} \biggl( \int_{1/a}^{e^{i\theta}/a} \mathrm{d}w \, \frac{\log a + \log(1 - w)}{w} \biggr) \\
&= 2 \operatorname{Im} \Bigl( i\theta \log a + \operatorname{Li}_2(1/a) - \operatorname{Li}_2(e^{i\theta}/a) \Bigr) \\
&= 2\theta \log a + i \left( \operatorname{Li}_2(e^{i\theta}/a) - \operatorname{Li}_2(e^{-i\theta}/a) \right).
\end{align*}
For general $a > 0$, the relation $ \mathcal{I}(a,\theta) = 2\theta \log a + \mathcal{I}(1/a,\theta) $ shows that
$$ \mathcal{I}(a,\theta)
= \begin{cases}
i \left( \operatorname{Li}_2(e^{i\theta}/a) - \operatorname{Li}_2(e^{-i\theta}/a) \right) + 2\theta \log a, & \text{if } a > 1, \\
i \left( \operatorname{Li}_2(ae^{i\theta}) - \operatorname{Li}_2(ae^{-i\theta}) \right), & \text{if } 0 < a \leq 1.
\end{cases} $$
