An error occurred while processing the template.
?substring(...) argument #2 had invalid value: The index must be at least 0, but was -1.

----
FTL stack trace ("~" means nesting-related):
	- Failed at: #assign journalArticleId = themeDispl...  [in template "20099#20125#42417" at line 10, column 1]
----
1<#assign url = themeDisplay.getURLCurrent() 
2index = 0/> 
3 
4<#assign journalArticleId = themeDisplay.getURLCurrent()?substring(themeDisplay.getURLCurrent()?index_of("id="))+3/> 
5 
6 
7<#assign indexInizio = themeDisplay.getURLCurrent()?index_of("id=")+3> 
8<#assign indexFine= themeDisplay.getURLCurrent()?index_of("&from=")> 
9  
10<#assign journalArticleId = themeDisplay.getURLCurrent()?substring(indexInizio, indexFine)/> 
11 
12<!--NEWS --> 
13<#if journalArticleId?has_content> 
14 
15<#if entries?has_content> 
16	<#list entries as curEntry> 
17	  <#if curEntry.getEntryId() == journalArticleId?number> 
18 
19<#assign 
20		assetRenderer = curEntry.getAssetRenderer() 
21		entryTitle = htmlUtil.escape(assetRenderer.getTitle(locale)) 
22		docXml = saxReaderUtil.read(assetRenderer.getArticle().getContent()) 
23		dataCreazione = curEntry.getCreateDate()  
24		 
25		/> 
26		 
27		<#if assetRenderer.getArticle().getExpandoBridge()?has_content && assetRenderer.getArticle().getExpandoBridge().getAttribute("progressivoInfoSharing")?has_content> 
28		  
29				 <#assign numeroDocumento = assetRenderer.getArticle().getExpandoBridge().getAttribute("progressivoInfoSharing") /> 
30				  
31		</#if> 
32  
33<#assign fields = assetRenderer.getDDMFormValuesReader().getDDMFormValues().getDDMFormFieldValues()/> 
34								<#list fields as currentField> 
35												<#if currentField.getDDMFormField().getFieldReference()=='titolo'> 
36													<#assign titolo=currentField.getValue().getString(themeDisplay.getLocale()) /> 
37												</#if> 
38												<#if currentField.getDDMFormField().getFieldReference()=='areaDiTesto'> 
39													<#assign descrizione=currentField.getValue().getString(themeDisplay.getLocale()) /> 
40												</#if> 
41												<#if currentField.getDDMFormField().getFieldReference()=='dataPubblicazione'> 
42													<#assign dataPubblicazione=currentField.getValue().getString(themeDisplay.getLocale()) /> 
43												</#if> 
44												<#if currentField.getDDMFormField().getFieldReference()=='immagine'> 
45													<#assign image=currentField.getValue().getString(themeDisplay.getLocale()) /> 
46													<#assign imageObj = jsonFactoryUtil.createJSONObject(image) /> 
47												</#if> 
48												<#if currentField.getDDMFormField().getFieldReference()=='dataAggiornamento'> 
49													<#assign dataAggiornamento=currentField.getValue().getString(themeDisplay.getLocale()) /> 
50												</#if> 
51												<#if currentField.getDDMFormField().getFieldReference()=='fattoreDiRischio'> 
52													<#if currentField ?has_content && currentField.getValue()?has_content && currentField.getValue().getString(themeDisplay.getLocale())?has_content> 
53														<#assign selezione=currentField.getValue().getString(themeDisplay.getLocale()) /> 
54															<#if selezione?? >  
55																	<#if currentField.getDDMFormField().getDDMFormFieldOptions().getOptions()??> 
56																			<#assign listOptions = currentField.getDDMFormField().getDDMFormFieldOptions().getOptions() /> 
57																			<#list listOptions as currentOptionKey, currentOptionValue> 
58																				<#if selezione== currentOptionKey>  
59																					<#assign valoreScelto= currentOptionValue.getString(themeDisplay.getLocale())?lower_case /> 
60																				</#if> 
61																			</#list> 
62																	</#if> 
63															</#if>	 
64														</#if> 
65												</#if> 
66											<#if currentField.getDDMFormField().getFieldReference()?contains("GruppoCampi")> 
67											  
68													<#assign fieldsListNested  =currentField.getNestedDDMFormFieldValues()/> 
69								 						<#list fieldsListNested as currentFieldNested> 
70															<#if  currentFieldNested.getDDMFormField().getFieldReference()== 'tipoDocumento' > 
71																 <#if currentFieldNested ?has_content && currentFieldNested.getValue()?has_content && currentFieldNested.getValue().getString(themeDisplay.getLocale())?has_content> 
72																 	<#assign selezioneTipoDocumento = currentFieldNested.getValue().getString(themeDisplay.getLocale())/> 
73																	  
74																 		<#if selezioneTipoDocumento?? >  
75																		   <#assign indexInizioSelezione = selezioneTipoDocumento?index_of("[")+2> 
76																				<#assign indexFineSelezione= selezioneTipoDocumento?index_of("]")> 
77																				   
78																				 <#assign codiceTipoDocumento = selezioneTipoDocumento?substring(indexInizioSelezione, indexFineSelezione-1)/> 
79																				  
80																		 		<#if currentFieldNested.getDDMFormField().getDDMFormFieldOptions().getOptions()??> 
81																						<#assign listOptionsTipoDoc = currentFieldNested.getDDMFormField().getDDMFormFieldOptions().getOptions() /> 
82																							<#list listOptionsTipoDoc as currentOptionKey, currentOptionValue>																							  
83																								<#if codiceTipoDocumento == currentOptionKey>  
84																									<#assign valoreTipoDocumento= currentOptionValue.getString(themeDisplay.getLocale()) /> 
85																								  
86																								</#if> 
87																							</#list> 
88																				</#if> 
89																		 </#if> 
90																		 
91																   </#if> 
92															</#if> 
93																	<#if  currentFieldNested.getDDMFormField().getFieldReference()== 'dataDocumento' > 
94																		<#assign dataDocumento = currentFieldNested.getValue().getString(themeDisplay.getLocale())/> 
95														 		</#if> 
96																  
97														</#list> 
98											</#if> 
99								</#list> 
100<#assign contacts = docXml.getRootElement()/> 
101<#assign categories =curEntry.getCategories()/> 
102 
103       <main class="container ct-main"> 
104			 		<div class="subtitle-wrapper"> 
105            <span class="subtitle"><img src="/o/CSIRTTema/images/svg/calendar.svg" alt="${languageUtil.get(locale, "label.ricerca.calendario")}"> ${dataPubblicazione?datetime("yyyy-MM-dd")?string("dd MMMM yyyy")}</span> 
106						<span class="subtitle-id">${languageUtil.get(locale, "label.idDocumento")}:<p> <#if valoreTipoDocumento??>${valoreTipoDocumento}</#if><#if dataDocumento?has_content>-${dataDocumento?datetime("yyyy-MM-dd")?string("dd/MM/yyyy")}</#if><#if numeroDocumento?has_content>-${numeroDocumento}</#if></p></span> 
107					</div> 
108            <h1 class="title">${titolo}</h1> 
109             
110						<div id="ctDettCatalogo"> 
111                <div class="cropped img-wrapper"> 
112                    <img src="/documents/${imageObj.getString('groupId')}/${imageObj.getString('uuid')}" alt="">   
113                </div> 
114								<div class="wrapper-between"> 
115									 <div class="date-wrapper"> 
116													<#if dataAggiornamento?has_content> 
117														 <span class="subtitle"><img src="/o/CSIRTTema/images/svg/calendar.svg" alt="${languageUtil.get(locale, "label.ricerca.calendario")}">${languageUtil.get(locale, "label.normativa.dataaggiornamento")} :</span> 
118															<span class="subtitle subtitle--date">  
119															${dataAggiornamento?datetime("yyyy-MM-dd")?string("dd MMMM yyyy")} 
120														</span> 
121													</#if> 
122									</div>								 
123									<div class="fattore-rischio"> 
124													<span class="subtitle">${languageUtil.get(locale, "label.informationSharing.fattoreDiRischio")}:</span> 
125													<div class="semaforo-wrapper"> 
126															<p class="livello-rischio"><#if valoreScelto??>${valoreScelto}</#if></p> 
127															<div class="semaforo ${valoreScelto}"> 
128																	<div class="rischio rischio--alto"></div> 
129																	<div class="rischio rischio--medio"></div> 
130																	<div class="rischio rischio--basso"></div> 
131																	<div class="rischio rischio--minimo"></div> 
132															</div> 
133													</div> 
134											</div> 
135									</div> 
136                <div class="text-wrapper"> 
137                    <p>${descrizione}</p> 
138 
139                     <div class="tags-wrap"> 
140												<#list categories as category>     
141																		 <div class="tag">${category.name}</div> 
142											</#list> 
143                    </div> 
144										 
145											 
146							 
147 
148<#attempt> 
149<#assign fieldsAllegati = assetRenderer.getDDMFormValuesReader().getDDMFormValues().getDDMFormFieldValues()/> 
150				<#list fieldsAllegati as currentFieldAllegati> 
151													<#if currentFieldAllegati.getDDMFormField().getFieldReference()=='allegati'> 
152														<#assign imgObjAllegati = jsonFactoryUtil.createJSONObject(currentFieldAllegati.getValue().getString(themeDisplay.getLocale()))/> 
153														 <#if imgObjAllegati != "{}"> 
154																<div class="link-wrapper"> 
155																	 <a href="/documents/${imgObjAllegati.getString('groupId')}/${imgObjAllegati.getString('uuid')}" title="${imgObjAllegati.getString('title')}"  
156																			 target="blank" aria-label="${languageUtil.get(locale, "label.vaiallink")}" class="link">${imgObjAllegati.getString('title')} 
157																				<img src="/o/CSIRTTema/images/svg/icon-link.svg" alt="link"> 
158																		</a> 
159															</div> 
160														</#if> 
161												</#if> 
162											</#list> 
163										 <#recover> 
164									</#attempt> 
165                </div> 
166            </div> 
167        </main> 
168 
169				<#break> 
170</#if> 
171	</#list> 
172</#if> 
173</#if>